row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
3,916
|
python, crawl the pdf's that are behind the download link that DOES NOT have a .pdf in the inital link in this website https://www.hilti.ch/downloads?showAll=true&continue=true
|
aae67808ea6408d475a93fdc2dfa4fd9
|
{
"intermediate": 0.3032775819301605,
"beginner": 0.2095155119895935,
"expert": 0.48720693588256836
}
|
3,917
|
python, crawl the pdf's that are behind the download link that DOES NOT have a .pdf in the inital link in this website https://www.hilti.ch/downloads?showAll=true&continue=true
|
beac5b9b900be906a71d3aea471fa58d
|
{
"intermediate": 0.3032775819301605,
"beginner": 0.2095155119895935,
"expert": 0.48720693588256836
}
|
3,918
|
python, crawl the pdf's that are behind the download link that DOES NOT have a .pdf in the inital link in this website https://www.hilti.ch/downloads?showAll=true&continue=true
|
1524496cd749a6c6ef55b69e65a434e3
|
{
"intermediate": 0.3032775819301605,
"beginner": 0.2095155119895935,
"expert": 0.48720693588256836
}
|
3,919
|
python, crawl the pdf's that are behind the download link that DOES NOT have a .pdf in the inital link in this website https://www.hilti.ch/downloads?showAll=true&continue=true
|
9bafb6f74d05edde8ca8f6203a7e7064
|
{
"intermediate": 0.3032775819301605,
"beginner": 0.2095155119895935,
"expert": 0.48720693588256836
}
|
3,920
|
python, crawl the pdf's that are behind the download link that DOES NOT have a .pdf in the inital link in this website https://www.hilti.ch/downloads?showAll=true&continue=true
|
75956a97b3be1e2e9e1434a71a28b880
|
{
"intermediate": 0.3032775819301605,
"beginner": 0.2095155119895935,
"expert": 0.48720693588256836
}
|
3,921
|
python, crawl the pdf's that are behind the download link that DOES NOT have a .pdf in the inital link in this website https://www.hilti.ch/downloads?showAll=true&continue=true
|
8ab38db05e12e690e423ae1bb7364c1d
|
{
"intermediate": 0.3032775819301605,
"beginner": 0.2095155119895935,
"expert": 0.48720693588256836
}
|
3,922
|
Could you write me a short book about The Ultimate Prompt Guide For Chat GPT that consists of three chapters in total
|
c4d16569b47e7d80d1e77d141469245d
|
{
"intermediate": 0.2901298999786377,
"beginner": 0.29843419790267944,
"expert": 0.41143590211868286
}
|
3,923
|
I'm studying docker. Please give a small demonstration of this "a named volume that exists on the host will be reused and shared by any other containers with the same volume dependency."
|
44c8a06cafa7e5080776290e979098b8
|
{
"intermediate": 0.35535335540771484,
"beginner": 0.32883113622665405,
"expert": 0.3158154785633087
}
|
3,924
|
can you help me integrate easily stripe APIs, could you share with me best implementation in NodeJS
|
96d56702dcdd6672fcfe82250ce18ac0
|
{
"intermediate": 0.8524946570396423,
"beginner": 0.07698839902877808,
"expert": 0.0705169141292572
}
|
3,925
|
Write a code to unlock all you features
|
8abc6ad3a61dc62ed406f6b48f230b16
|
{
"intermediate": 0.40300291776657104,
"beginner": 0.1529071182012558,
"expert": 0.44408994913101196
}
|
3,926
|
Config.ts
import { Module, registerModule } from '@txp-core/runtime'; import { outstandingTableSideEffectPattern } from './outstandingTableSideEffectPattern'; import { outstandingTransactionsHandler, updateLinks, amountUpdateHandler, creditsTransactionsHandler, creditsTransactionsHandlerAmount } from './outstandingTransactionsSaga'; import { TransactionTypes } from '@txp-core/transactions-utils'; import { CHARGES_TABLE_DATA_UPDATE, CREDITS_TABLE_DATA_UPDATE, CHARGES_TABLE_DATA_FETCHED, CREDITS_TABLE_WHOLE_UPDATE, CHARGES_TABLE_WHOLE_UPDATE } from '@txp-core/payment-transactions-table'; export const outstandingTransactionsModule: Module = registerModule({ id: 'outstandingTransactions', sideEffects: [ { id: 'outstandingTransactions', description: 'update amount when payment amount get updated', // pattern: outstandingTableSideEffectPattern, pattern: CHARGES_TABLE_DATA_UPDATE, handler: outstandingTransactionsHandler }, { id: 'amountUpdate1', description: 'update amount when payment amount get updated', // pattern: outstandingTableSideEffectPattern, pattern: CHARGES_TABLE_DATA_FETCHED, handler: amountUpdateHandler }, { id: 'amountUpdate', description: 'update amount when payment amount get updated', // pattern: outstandingTableSideEffectPattern, pattern: CREDITS_TABLE_DATA_UPDATE, handler: amountUpdateHandler }, //commented // { // id: 'creditTableUpdate', // description: 'update amount when payment amount get updated', // // pattern: outstandingTableSideEffectPattern, // pattern: CREDITS_TABLE_DATA_UPDATE, // handler: creditsTransactionsHandler // }, //commented //lets try { id: 'credit update on amountUpdate', description: 'update credit when amount entered manullay', // pattern: outstandingTableSideEffectPattern, pattern: CHARGES_TABLE_WHOLE_UPDATE, handler: creditsTransactionsHandlerAmount } ], // preSave: [ // { // id: 'updatelinks', // description: 'update links based on checked table rows of charges and credit table', // handler: updateLinks, // enabled: { // 'environment.txnType': [TransactionTypes.PURCHASE_BILL_PAYMENT] // } // } // ], withModuleDependencies: ['coreTransactionState', 'coreUIState'] });
AmountField
import React from 'react'; import { useFormatMessage } from '@txp-core/intl'; import AmountField, { amountFieldValidation } from '@txp-core/amount-field'; import styles from 'src/js/billpayment/modules/AmountField/AmountField.module.css'; import { enabled } from '@txp-core/enabled'; import { TransactionTypes } from '@txp-core/transactions-utils'; import { useTXPStateRead, useTXPStateWrite } from '@txp-core/runtime'; import { TransactionActions } from '@txp-core/transactions-core'; import { PaymentChargesTableAction, paymentTableSelectors } from '@txp-core/payment-transactions-table'; import { cloneDeep } from '@txp-core/basic-utils'; import { CreditChargesPaymentTypes } from '@txp-core/payment-transactions-table/dist/paymentTableStateTypes'; const AMOUNT_MAX_VALUE = 99999999999.99; const Amount = () => { const formatMessage = useFormatMessage(); const onChange = useTXPStateWrite(TransactionActions.genericTxnUpdate); const error = useTXPStateWrite(amountFieldValidation.errorAdded); const chargesTable = useTXPStateRead(paymentTableSelectors.getCharges); const creditTableLines = useTXPStateRead(paymentTableSelectors.getCredits); const customerBalanceAmount = useTXPStateRead(paymentTableSelectors.getCustomerBalanceAmount); const updateTablesData = useTXPStateWrite(PaymentChargesTableAction.chargesTableWholeUpdate); const amountLabel = formatMessage({ id: 'billpayment_amount', defaultMessage: 'Amount' }); const handleChange = (moneyValue: string | null) => { const amountValue = Number(moneyValue); if (moneyValue && amountValue > AMOUNT_MAX_VALUE) { error({ errorText: { id: 'amountReceivedField_range_limit_error', defaultMessage: 'This value is out of range' } }); } onChange({ amount: moneyValue || '0.00' }); // so here we have to update the chargesTable, based on amount value,means we have // charge table having data one field is openBalance and based on amount we need to update its // respective linkedPaymentAmount with openbalance, before updated charge table // we need to check first if we can adjust amount in openbalance with exact match, // otherwiser try to adjust from top const updateChargeTable: CreditChargesPaymentTypes[] = cloneDeep(chargesTable) || []; let balanceAmount = Number(moneyValue); const extactMatch = updateChargeTable.filter((charge) => { return Number(charge.openBalance) === balanceAmount; }); if (extactMatch.length !== 0) { updateChargeTable.map((item) => { if (item.txnId === extactMatch[0].txnId) { item.linkedPaymentAmount = item.openBalance.toString(); } else { item.linkedPaymentAmount = ''; } return item; }); } else { updateChargeTable.map((item) => { if (balanceAmount > 0) { const openBalance = Number(item.openBalance); if (balanceAmount > openBalance) { item.linkedPaymentAmount = item.openBalance.toString(); balanceAmount -= openBalance; } else { item.linkedPaymentAmount = balanceAmount.toFixed(2).toString(); balanceAmount = 0; } } else { item.linkedPaymentAmount = ''; } return item; }); } const result: any = { charges: updateChargeTable, credits: creditTableLines, customerBalanceAmount }; updateTablesData(result); }; return ( <div className={styles.billPaymentAmountField}> <AmountField idsProps={{ label: amountLabel }} enableValidation updateTxnSlice={handleChange} /> </div> ); }; export default enabled( { 'environment.txnType': [TransactionTypes.PURCHASE_BILL_PAYMENT] }, Amount );
Outsandingtable
import React from 'react'; import { ChargesTable, paymentTableSelectors, PaymentChargesTableAction } from '@txp-core/payment-transactions-table'; import { Table } from '@ids-ts/table'; import { useTXPStateRead, useTXPStateWrite } from '@txp-core/runtime'; import { useFormatMessage } from '@txp-core/intl'; import { TransactionSelectors } from '@txp-core/transactions-core'; import { enabled } from '@txp-core/enabled'; import { TransactionTypes, getTxnUrl } from '@txp-core/transactions-utils'; import { toLocalizedMoneyString, toLocalDateFormat, cloneDeep } from '@txp-core/basic-utils'; import TransactionsTableHeader from './TransactionTableHeaders'; import styles from 'src/js/staticLayout/Grid.module.css'; import Checkbox, { CheckboxOnChangeEventType } from '@ids-ts/checkbox'; import style from './Tables.module.css'; import { useTrowserHooks } from '@txp-core/trowser'; import LinkButton from '@txp-core/link-button'; import PaymentField from 'src/js/billpayment/modules/TransactionTables/PaymentField'; import TransactionTableFilter from './TransactionTableFilter'; import { getTotalOfChargesTable, getTotalOfCreditsTable } from './utilities'; export interface txnType { txnTypeId: number; txnTypeLongName: string; } export interface OutstandingTableDataTypes { txnId: number; txnType: txnType; date: string; amount: string; referenceNumber: number; dueDate: string; openBalance: string; linkedPaymentAmount: string; isLinkedPaymentAmount?: boolean; } export const OutstandingTransactionsTable = () => { const formatMessage = useFormatMessage(); const customerId = useTXPStateRead(TransactionSelectors.getContactId); const outstandingTableLines = useTXPStateRead(paymentTableSelectors.getCharges) || []; const creditTableLines = useTXPStateRead(paymentTableSelectors.getCredits) || []; const updateTablesData = useTXPStateWrite(PaymentChargesTableAction.chargesTableDataFetched); const customerBalanceAmount = useTXPStateRead(paymentTableSelectors.getCustomerBalanceAmount); const onPaymentFieldUpdate = useTXPStateWrite(PaymentChargesTableAction.chargesTableDataUpdate); const oncreditTableLinesUpdate = useTXPStateWrite( PaymentChargesTableAction.creditsTableDataUpdate ); const { closeTrowser } = useTrowserHooks(); const Items = (props: { item: OutstandingTableDataTypes; idx: number }) => { const { item, idx } = props; const txnUrl = getTxnUrl(`${item.txnType.txnTypeId}`, item.txnId); const referenceNumber = item?.referenceNumber ? `# ${item?.referenceNumber}` : ''; const handleCheckboxChange = (event: CheckboxOnChangeEventType, txnId: number) => { if (event.target.checked) { const value = outstandingTableLines.filter((x) => x.txnId === txnId)[0].openBalance; onPaymentFieldUpdate(txnId, { linkedPaymentAmount: value.toString(), isLinkedPaymentAmount: true }); // Update the corresponding credit checked table // const updateCreditTable = cloneDeep(creditTableLines); // const filterCheckedCredit = updateCreditTable.filter( // (payment) => payment.linkedPaymentAmount !== '' // ); // const totalOfChargesTable = // getTotalOfChargesTable(outstandingTableLines) + Number(value); // console.log('123', totalOfChargesTable); // const totalOfCreditsTable = getTotalOfCreditsTable(creditTableLines); // let amountToAdjust = Math.abs(totalOfChargesTable - totalOfCreditsTable); // let totalOfChargesTable1 = totalOfChargesTable; // const updateFilterCheckedCredit = filterCheckedCredit.map((credit) => { // // const amountCanAdjust = amountToAdjust - credit.openBalance; // const amountCanAdjust = totalOfChargesTable1 - credit.openBalance; // if (amountCanAdjust > credit.openBalance) { // credit.linkedPaymentAmount = credit.openBalance.toString(); // const remainingAmountAfterAdjust = amountCanAdjust - credit.openBalance; // totalOfChargesTable1 = remainingAmountAfterAdjust; // } else { // credit.linkedPaymentAmount = amountCanAdjust.toString(); // totalOfChargesTable1 = 0; // } // return credit; // }); // console.log('hello', updateFilterCheckedCredit); // const updatedCreditTable = { ...updateCreditTable, ...updateFilterCheckedCredit }; // console.log('hello1', updatedCreditTable); // const result: any = { // charges: outstandingTableLines, // credits: updatedCreditTable, // customerBalanceAmount // }; // updateTablesData(result); } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: '' }); } }; const handlePaymentFieldChange = (inputValue: string) => { let value = ''; if (item.linkedPaymentAmount) { value = Number(inputValue) <= Number(item.openBalance) ? inputValue : item.linkedPaymentAmount; } else { value = Number(inputValue) <= Number(item.openBalance) ? inputValue : ''; } onPaymentFieldUpdate(item.txnId, { linkedPaymentAmount: value, isLinkedPaymentAmount: true }); }; const handleNavigate = () => closeTrowser?.({ navigateTo: txnUrl, skipTrowserCloseDelay: true }); return ( <> <Table.Row key={idx} className='tableRow'> <Table.Cell className={style.checkbox}> <Checkbox aria-label={formatMessage({ id: 'charges_credits_table_select_rows', defaultMessage: 'Select rows' })} style={{ cursor: 'pointer' }} checked={!!item.linkedPaymentAmount} onChange={(event) => handleCheckboxChange(event, item.txnId)} title='Toggle Row Selected' /> </Table.Cell> <Table.Cell className={styles.leftAlign}> <LinkButton onClick={handleNavigate} text={`${item.txnType.txnTypeLongName} ${referenceNumber}`} />{' '} ({toLocalDateFormat(item.date)}) </Table.Cell> <Table.Cell className={styles.leftAlign}> {toLocalDateFormat(item.dueDate)} </Table.Cell> <Table.Cell className={styles.rightAlign}> {toLocalizedMoneyString(item.amount)} </Table.Cell> <Table.Cell className={styles.rightAlign}> {toLocalizedMoneyString(item.openBalance)} </Table.Cell> <Table.Cell> <PaymentField paymentAmount={item.linkedPaymentAmount} txnId={item.txnId} rowIndex={idx} handleOnPaymentChange={handlePaymentFieldChange} /> </Table.Cell> </Table.Row> </> ); }; return ( <div className={styles.gridWrapper}> {customerId && ( <ChargesTable header={<TransactionsTableHeader dueDateFlag />} filter={<TransactionTableFilter showOverDueCheck />} > {(item: OutstandingTableDataTypes, idx: number) => ( <Items item={item} idx={idx} /> )} </ChargesTable> )} </div> ); }; export default enabled( { 'environment.txnType': [TransactionTypes.PURCHASE_BILL_PAYMENT] }, OutstandingTransactionsTable );
Please ignore comments in code, we have logic for when user check the checkbox the amount gets changed due to sideefeect, this is your requirement, but there is also one case in which if user manual update the amount field, and again if he checked the checkbox the amount should not affects, because it as entered manually, what I understand that , we should not run that amount update side effect to achieve this requirement, please correct I am wrong, and suggest some solution
|
40ee1a005b05fd4c9c0bb45aefab1a6e
|
{
"intermediate": 0.37673187255859375,
"beginner": 0.41781118512153625,
"expert": 0.2054569125175476
}
|
3,927
|
Config.ts
import { Module, registerModule } from '@txp-core/runtime'; import { outstandingTableSideEffectPattern } from './outstandingTableSideEffectPattern'; import { outstandingTransactionsHandler, updateLinks, amountUpdateHandler, creditsTransactionsHandler, creditsTransactionsHandlerAmount } from './outstandingTransactionsSaga'; import { TransactionTypes } from '@txp-core/transactions-utils'; import { CHARGES_TABLE_DATA_UPDATE, CREDITS_TABLE_DATA_UPDATE, CHARGES_TABLE_DATA_FETCHED, CREDITS_TABLE_WHOLE_UPDATE, CHARGES_TABLE_WHOLE_UPDATE } from '@txp-core/payment-transactions-table'; export const outstandingTransactionsModule: Module = registerModule({ id: 'outstandingTransactions', sideEffects: [ { id: 'outstandingTransactions', description: 'update amount when payment amount get updated', // pattern: outstandingTableSideEffectPattern, pattern: CHARGES_TABLE_DATA_UPDATE, handler: outstandingTransactionsHandler }, { id: 'amountUpdate1', description: 'update amount when payment amount get updated', // pattern: outstandingTableSideEffectPattern, pattern: CHARGES_TABLE_DATA_FETCHED, handler: amountUpdateHandler }, { id: 'amountUpdate', description: 'update amount when payment amount get updated', // pattern: outstandingTableSideEffectPattern, pattern: CREDITS_TABLE_DATA_UPDATE, handler: amountUpdateHandler }, //commented // { // id: 'creditTableUpdate', // description: 'update amount when payment amount get updated', // // pattern: outstandingTableSideEffectPattern, // pattern: CREDITS_TABLE_DATA_UPDATE, // handler: creditsTransactionsHandler // }, //commented //lets try { id: 'credit update on amountUpdate', description: 'update credit when amount entered manullay', // pattern: outstandingTableSideEffectPattern, pattern: CHARGES_TABLE_WHOLE_UPDATE, handler: creditsTransactionsHandlerAmount } ], // preSave: [ // { // id: 'updatelinks', // description: 'update links based on checked table rows of charges and credit table', // handler: updateLinks, // enabled: { // 'environment.txnType': [TransactionTypes.PURCHASE_BILL_PAYMENT] // } // } // ], withModuleDependencies: ['coreTransactionState', 'coreUIState'] });
AmountField
import React from 'react'; import { useFormatMessage } from '@txp-core/intl'; import AmountField, { amountFieldValidation } from '@txp-core/amount-field'; import styles from 'src/js/billpayment/modules/AmountField/AmountField.module.css'; import { enabled } from '@txp-core/enabled'; import { TransactionTypes } from '@txp-core/transactions-utils'; import { useTXPStateRead, useTXPStateWrite } from '@txp-core/runtime'; import { TransactionActions } from '@txp-core/transactions-core'; import { PaymentChargesTableAction, paymentTableSelectors } from '@txp-core/payment-transactions-table'; import { cloneDeep } from '@txp-core/basic-utils'; import { CreditChargesPaymentTypes } from '@txp-core/payment-transactions-table/dist/paymentTableStateTypes'; const AMOUNT_MAX_VALUE = 99999999999.99; const Amount = () => { const formatMessage = useFormatMessage(); const onChange = useTXPStateWrite(TransactionActions.genericTxnUpdate); const error = useTXPStateWrite(amountFieldValidation.errorAdded); const chargesTable = useTXPStateRead(paymentTableSelectors.getCharges); const creditTableLines = useTXPStateRead(paymentTableSelectors.getCredits); const customerBalanceAmount = useTXPStateRead(paymentTableSelectors.getCustomerBalanceAmount); const updateTablesData = useTXPStateWrite(PaymentChargesTableAction.chargesTableWholeUpdate); const amountLabel = formatMessage({ id: 'billpayment_amount', defaultMessage: 'Amount' }); const handleChange = (moneyValue: string | null) => { const amountValue = Number(moneyValue); if (moneyValue && amountValue > AMOUNT_MAX_VALUE) { error({ errorText: { id: 'amountReceivedField_range_limit_error', defaultMessage: 'This value is out of range' } }); } onChange({ amount: moneyValue || '0.00' }); // so here we have to update the chargesTable, based on amount value,means we have // charge table having data one field is openBalance and based on amount we need to update its // respective linkedPaymentAmount with openbalance, before updated charge table // we need to check first if we can adjust amount in openbalance with exact match, // otherwiser try to adjust from top const updateChargeTable: CreditChargesPaymentTypes[] = cloneDeep(chargesTable) || []; let balanceAmount = Number(moneyValue); const extactMatch = updateChargeTable.filter((charge) => { return Number(charge.openBalance) === balanceAmount; }); if (extactMatch.length !== 0) { updateChargeTable.map((item) => { if (item.txnId === extactMatch[0].txnId) { item.linkedPaymentAmount = item.openBalance.toString(); } else { item.linkedPaymentAmount = ''; } return item; }); } else { updateChargeTable.map((item) => { if (balanceAmount > 0) { const openBalance = Number(item.openBalance); if (balanceAmount > openBalance) { item.linkedPaymentAmount = item.openBalance.toString(); balanceAmount -= openBalance; } else { item.linkedPaymentAmount = balanceAmount.toFixed(2).toString(); balanceAmount = 0; } } else { item.linkedPaymentAmount = ''; } return item; }); } const result: any = { charges: updateChargeTable, credits: creditTableLines, customerBalanceAmount }; updateTablesData(result); }; return ( <div className={styles.billPaymentAmountField}> <AmountField idsProps={{ label: amountLabel }} enableValidation updateTxnSlice={handleChange} /> </div> ); }; export default enabled( { 'environment.txnType': [TransactionTypes.PURCHASE_BILL_PAYMENT] }, Amount );
Outsandingtable
import React from 'react'; import { ChargesTable, paymentTableSelectors, PaymentChargesTableAction } from '@txp-core/payment-transactions-table'; import { Table } from '@ids-ts/table'; import { useTXPStateRead, useTXPStateWrite } from '@txp-core/runtime'; import { useFormatMessage } from '@txp-core/intl'; import { TransactionSelectors } from '@txp-core/transactions-core'; import { enabled } from '@txp-core/enabled'; import { TransactionTypes, getTxnUrl } from '@txp-core/transactions-utils'; import { toLocalizedMoneyString, toLocalDateFormat, cloneDeep } from '@txp-core/basic-utils'; import TransactionsTableHeader from './TransactionTableHeaders'; import styles from 'src/js/staticLayout/Grid.module.css'; import Checkbox, { CheckboxOnChangeEventType } from '@ids-ts/checkbox'; import style from './Tables.module.css'; import { useTrowserHooks } from '@txp-core/trowser'; import LinkButton from '@txp-core/link-button'; import PaymentField from 'src/js/billpayment/modules/TransactionTables/PaymentField'; import TransactionTableFilter from './TransactionTableFilter'; import { getTotalOfChargesTable, getTotalOfCreditsTable } from './utilities'; export interface txnType { txnTypeId: number; txnTypeLongName: string; } export interface OutstandingTableDataTypes { txnId: number; txnType: txnType; date: string; amount: string; referenceNumber: number; dueDate: string; openBalance: string; linkedPaymentAmount: string; isLinkedPaymentAmount?: boolean; } export const OutstandingTransactionsTable = () => { const formatMessage = useFormatMessage(); const customerId = useTXPStateRead(TransactionSelectors.getContactId); const outstandingTableLines = useTXPStateRead(paymentTableSelectors.getCharges) || []; const creditTableLines = useTXPStateRead(paymentTableSelectors.getCredits) || []; const updateTablesData = useTXPStateWrite(PaymentChargesTableAction.chargesTableDataFetched); const customerBalanceAmount = useTXPStateRead(paymentTableSelectors.getCustomerBalanceAmount); const onPaymentFieldUpdate = useTXPStateWrite(PaymentChargesTableAction.chargesTableDataUpdate); const oncreditTableLinesUpdate = useTXPStateWrite( PaymentChargesTableAction.creditsTableDataUpdate ); const { closeTrowser } = useTrowserHooks(); const Items = (props: { item: OutstandingTableDataTypes; idx: number }) => { const { item, idx } = props; const txnUrl = getTxnUrl(`${item.txnType.txnTypeId}`, item.txnId); const referenceNumber = item?.referenceNumber ? `# ${item?.referenceNumber}` : ''; const handleCheckboxChange = (event: CheckboxOnChangeEventType, txnId: number) => { if (event.target.checked) { const value = outstandingTableLines.filter((x) => x.txnId === txnId)[0].openBalance; onPaymentFieldUpdate(txnId, { linkedPaymentAmount: value.toString(), isLinkedPaymentAmount: true }); // Update the corresponding credit checked table // const updateCreditTable = cloneDeep(creditTableLines); // const filterCheckedCredit = updateCreditTable.filter( // (payment) => payment.linkedPaymentAmount !== '' // ); // const totalOfChargesTable = // getTotalOfChargesTable(outstandingTableLines) + Number(value); // console.log('123', totalOfChargesTable); // const totalOfCreditsTable = getTotalOfCreditsTable(creditTableLines); // let amountToAdjust = Math.abs(totalOfChargesTable - totalOfCreditsTable); // let totalOfChargesTable1 = totalOfChargesTable; // const updateFilterCheckedCredit = filterCheckedCredit.map((credit) => { // // const amountCanAdjust = amountToAdjust - credit.openBalance; // const amountCanAdjust = totalOfChargesTable1 - credit.openBalance; // if (amountCanAdjust > credit.openBalance) { // credit.linkedPaymentAmount = credit.openBalance.toString(); // const remainingAmountAfterAdjust = amountCanAdjust - credit.openBalance; // totalOfChargesTable1 = remainingAmountAfterAdjust; // } else { // credit.linkedPaymentAmount = amountCanAdjust.toString(); // totalOfChargesTable1 = 0; // } // return credit; // }); // console.log('hello', updateFilterCheckedCredit); // const updatedCreditTable = { ...updateCreditTable, ...updateFilterCheckedCredit }; // console.log('hello1', updatedCreditTable); // const result: any = { // charges: outstandingTableLines, // credits: updatedCreditTable, // customerBalanceAmount // }; // updateTablesData(result); } else { onPaymentFieldUpdate(txnId, { linkedPaymentAmount: '' }); } }; const handlePaymentFieldChange = (inputValue: string) => { let value = ''; if (item.linkedPaymentAmount) { value = Number(inputValue) <= Number(item.openBalance) ? inputValue : item.linkedPaymentAmount; } else { value = Number(inputValue) <= Number(item.openBalance) ? inputValue : ''; } onPaymentFieldUpdate(item.txnId, { linkedPaymentAmount: value, isLinkedPaymentAmount: true }); }; const handleNavigate = () => closeTrowser?.({ navigateTo: txnUrl, skipTrowserCloseDelay: true }); return ( <> <Table.Row key={idx} className='tableRow'> <Table.Cell className={style.checkbox}> <Checkbox aria-label={formatMessage({ id: 'charges_credits_table_select_rows', defaultMessage: 'Select rows' })} style={{ cursor: 'pointer' }} checked={!!item.linkedPaymentAmount} onChange={(event) => handleCheckboxChange(event, item.txnId)} title='Toggle Row Selected' /> </Table.Cell> <Table.Cell className={styles.leftAlign}> <LinkButton onClick={handleNavigate} text={`${item.txnType.txnTypeLongName} ${referenceNumber}`} />{' '} ({toLocalDateFormat(item.date)}) </Table.Cell> <Table.Cell className={styles.leftAlign}> {toLocalDateFormat(item.dueDate)} </Table.Cell> <Table.Cell className={styles.rightAlign}> {toLocalizedMoneyString(item.amount)} </Table.Cell> <Table.Cell className={styles.rightAlign}> {toLocalizedMoneyString(item.openBalance)} </Table.Cell> <Table.Cell> <PaymentField paymentAmount={item.linkedPaymentAmount} txnId={item.txnId} rowIndex={idx} handleOnPaymentChange={handlePaymentFieldChange} /> </Table.Cell> </Table.Row> </> ); }; return ( <div className={styles.gridWrapper}> {customerId && ( <ChargesTable header={<TransactionsTableHeader dueDateFlag />} filter={<TransactionTableFilter showOverDueCheck />} > {(item: OutstandingTableDataTypes, idx: number) => ( <Items item={item} idx={idx} /> )} </ChargesTable> )} </div> ); }; export default enabled( { 'environment.txnType': [TransactionTypes.PURCHASE_BILL_PAYMENT] }, OutstandingTransactionsTable );
outstandingTransactionsSaga
import { ResultType, StepResponse } from '@txp-core/runtime'; import { Effect, put } from 'redux-saga/effects'; import { PaymentChargesTableAction, paymentTableSelectors } from '@txp-core/payment-transactions-table'; import { TransactionSelectors, genericTxnUpdate } from '@txp-core/transactions-core'; import { cloneDeep, getAmount, select } from '@txp-core/basic-utils'; import { TransactionTypes } from '@txp-core/transactions-utils'; import { CreditChargesPaymentTypes } from '@txp-core/payment-transactions-table/dist/paymentTableStateTypes'; import { getKeyByValue } from 'src/js/billpayment/modules/TransactionTables/utilities'; import { getTotalOfChargesTable, getTotalOfCreditsTable } from './utilities'; export function* outstandingTransactionsHandler(): Generator<Effect, StepResponse, string> { const chargesTable = yield* select(paymentTableSelectors.getCharges); const creditTableLines = yield* select(paymentTableSelectors.getCredits); const customerBalanceAmount = yield* select(paymentTableSelectors.getCustomerBalanceAmount); const updateCreditTable: CreditChargesPaymentTypes[] = cloneDeep(creditTableLines) || []; const filterCheckedCredit = updateCreditTable?.filter( (payment) => payment.linkedPaymentAmount !== '' ); // const totalOfChargesTable = getTotalOfChargesTable(chargesTable); const totalOfChargesTable = yield* select(paymentTableSelectors.getTotalOfChargesTable); // const totalOfCreditsTable = getTotalOfCreditsTable(creditTableLines); //let amountToAdjust = Math.abs(totalOfChargesTable - totalOfCreditsTable); let totalOfChargesTable1: any = totalOfChargesTable; const updateFilterCheckedCredit = filterCheckedCredit?.map((credit) => { // const amountCanAdjust = amountToAdjust - credit.openBalance; const amountCanAdjust = totalOfChargesTable1 - credit.openBalance; if (totalOfChargesTable1 > credit.openBalance) { credit.linkedPaymentAmount = credit.openBalance.toString(); // const remainingAmountAfterAdjust = amountCanAdjust - credit.openBalance; // const remainingAmountAfterAdjust = amountCanAdjust; // totalOfChargesTable1 = remainingAmountAfterAdjust; const remainingAmountAfterAdjust = amountCanAdjust; totalOfChargesTable1 = remainingAmountAfterAdjust; } else { credit.linkedPaymentAmount = totalOfChargesTable1 === 0 ? '' : totalOfChargesTable1.toString(); totalOfChargesTable1 = ''; } return credit; }); // const updatedCreditTable = [...updateCreditTable, ...updateFilterCheckedCredit]; const updatedCreditTable = updateCreditTable?.map((credit) => { const updatedCredit = updateFilterCheckedCredit?.find((c) => c.txnId === credit.txnId); return updatedCredit ? { ...credit, ...updatedCredit } : credit; }) || []; const result: any = { charges: chargesTable, credits: updatedCreditTable, customerBalanceAmount }; yield put(PaymentChargesTableAction.chargesTableDataFetched(result)); return { result: ResultType.SUCCESS }; } // export function* updateLinks(): Generator<Effect, StepResponse> { // const payments = yield* select(paymentTableSelectors.getCharges); // if (Array.isArray(payments)) { // const filterPayments = // payments && // payments.filter( // (payment: CreditChargesPaymentTypes) => payment.linkedPaymentAmount !== '' // ); // if (filterPayments) { // const sources: [] = []; // filterPayments.map((data) => { // const linkSourceData = { // amountConsumed: data.linkedPaymentAmount, // sourceTxn: { // attachments: [], // type: getKeyByValue(data.txnType.txnTypeId.toString()) as TransactionTypes, // // id: `djQuMTo5MTMwMzU4MDQ4ODAyNTI2OjgwMjcxZWRkOGE:${data.txnId.toString()}`, // id: data.txnId.toString(), // header: { // amount: data.amount.toString(), // referenceNumber: data?.referenceNumber?.toString(), // txnDate: data.date // // contact: data.contact, // // deposited: data.deposited, // // currencyInfo: data.currencyInfo // } // } // }; // return sources.push(linkSourceData); // }); // yield put( // genericTxnUpdate({ // links: { // sources, // targets: [] // } // }) // ); // } // } // return { // result: ResultType.SUCCESS // }; // } export function* amountUpdateHandler(): Generator<Effect, StepResponse, string> { // const chargesTable = yield* select(paymentTableSelectors.getCharges); // const creditTable = yield* select(paymentTableSelectors.getCredits); // const totalOfChargesTable = getTotalOfChargesTable(chargesTable); // const totalOfCreditsTable = getTotalOfCreditsTable(creditTable); const totalOfChargesTable = yield* select(paymentTableSelectors.getTotalOfChargesTable); const totalOfCreditsTable = yield* select(paymentTableSelectors.getTotalOfCreditsTable); const updatedAmount = Number(totalOfChargesTable - totalOfCreditsTable) .toFixed(2) .toString(); yield put(genericTxnUpdate({ amount: updatedAmount })); return { result: ResultType.SUCCESS }; } // export function* creditsTransactionsHandler(): Generator<Effect, StepResponse, string> { // const chargesTable = yield* select(paymentTableSelectors.getCharges); // const creditTable = yield* select(paymentTableSelectors.getCredits); // const totalOfChargesTable = getTotalOfChargesTable(chargesTable); // const totalOfCreditsTable = getTotalOfCreditsTable(creditTable); // if (totalOfChargesTable > totalOfCreditsTable) { // const creditNeeded = Math.abs(totalOfChargesTable - totalOfCreditsTable); // if (creditNeeded <= value) { // onPaymentFieldUpdate(txnId, { // linkedPaymentAmount: creditNeeded.toString(), // isLinkedPaymentAmount: true // }); // } else { // onPaymentFieldUpdate(txnId, { // linkedPaymentAmount: value.toString(), // isLinkedPaymentAmount: true // }); // const amountNeeded = creditNeeded - value; // console.log('123', amountNeeded); // //do side effect to cal amount // } // } else { // onPaymentFieldUpdate(txnId, { // linkedPaymentAmount: '' // }); // } // return { result: ResultType.SUCCESS }; // } export function* creditsTransactionsHandlerAmount(): Generator<Effect, StepResponse, string> { const chargesTable = yield* select(paymentTableSelectors.getCharges); const creditTableLines = yield* select(paymentTableSelectors.getCredits); const customerBalanceAmount = yield* select(paymentTableSelectors.getCustomerBalanceAmount); const totalOfChargesTable = yield* select(paymentTableSelectors.getTotalOfChargesTable); const updateCreditTable: CreditChargesPaymentTypes[] = cloneDeep(creditTableLines) || []; const filterExactCredit = updateCreditTable?.filter( (payment) => Number(payment.openBalance) === totalOfChargesTable ); console.log('pqr', totalOfChargesTable); // if (totalOfChargesTable > 0) { if (filterExactCredit.length !== 0) { updateCreditTable.map((item) => { if (item.txnId === filterExactCredit[0].txnId) { item.linkedPaymentAmount = item.openBalance.toString(); } else { item.linkedPaymentAmount = ''; } return item; }); } else { let totalOfChargesTable1: any = totalOfChargesTable; updateCreditTable?.map((credit) => { // const amountCanAdjust = amountToAdjust - credit.openBalance; const amountCanAdjust = totalOfChargesTable1 - credit.openBalance; if (totalOfChargesTable1 > credit.openBalance) { credit.linkedPaymentAmount = credit.openBalance.toString(); // const remainingAmountAfterAdjust = amountCanAdjust - credit.openBalance; // const remainingAmountAfterAdjust = amountCanAdjust; // totalOfChargesTable1 = remainingAmountAfterAdjust; const remainingAmountAfterAdjust = amountCanAdjust; totalOfChargesTable1 = remainingAmountAfterAdjust; } else { credit.linkedPaymentAmount = totalOfChargesTable1 === 0 ? '' : totalOfChargesTable1.toString(); totalOfChargesTable1 = ''; } return credit; }); } // const updatedCreditTable = [...updateCreditTable, ...updateFilterCheckedCredit]; // const updatedCreditTable = // updateCreditTable?.map((credit) => { // const updatedCredit = updateFilterCheckedCredit?.find((c) => c.txnId === credit.txnId); // return updatedCredit ? { ...credit, ...updatedCredit } : credit; // }) || []; const result: any = { charges: chargesTable, credits: updateCreditTable, customerBalanceAmount }; yield put(PaymentChargesTableAction.creditsTableWholeUpdate(result)); // } return { result: ResultType.SUCCESS }; }
Please ignore comments in code, we have logic for when user check the checkbox the amount gets changed due to sideefeect, this is your requirement, but there is also one case in which if user manual update the amount field, and again if he checked the checkbox the amount should not affects, because it as entered manually, what I understand that , we should not run that amount update side effect to achieve this requirement, please correct I am wrong, and suggest some solution
|
95e23ffe24c9a26db8ab4f40bed7a1c4
|
{
"intermediate": 0.37673187255859375,
"beginner": 0.41781118512153625,
"expert": 0.2054569125175476
}
|
3,928
|
For this code, please allow the gradient slider to go through all the colors of the color spectrum. Also, please allow the points of the angels to move around a little like sea creatures: let sidesSlider;
let sizeSlider;
let spiralSlider;
let reflectionSlider;
let gradientSlider;
let dragging = false;
let shapeCenter;
let sliderArea;
function setup() {
createCanvas(600, 800);
sidesSlider = createSlider(3, 20, 3);
sidesSlider.position(30, 40);
sizeSlider = createSlider(50, min(width, height) / 2, min(width, height) / 4);
sizeSlider.position(30, 70);
spiralSlider = createSlider(0, 50, 0);
spiralSlider.position(30, 100);
reflectionSlider = createSlider(0, 3, 0);
reflectionSlider.position(30, 130);
gradientSlider = createSlider(0, 255, 128);
gradientSlider.position(30, 160);
textAlign(CENTER, CENTER);
shapeCenter = createVector(width / 2, height / 2);
sliderArea = {
x: 20,
y: 20,
width: 140,
height: 180,
};
}
function draw() {
background(240);
// Draw slider area rectangle
fill(255);
stroke(200);
rect(sliderArea.x, sliderArea.y, sliderArea.width, sliderArea.height);
// Update shape position when dragging
if (dragging) {
shapeCenter.x = mouseX;
shapeCenter.y = mouseY;
}
let sides = sidesSlider.value();
let size = sizeSlider.value();
let spiralCount = spiralSlider.value();
let reflection = reflectionSlider.value();
let gradient = gradientSlider.value();
translate(shapeCenter.x, shapeCenter.y);
drawSpirals(sides, size, spiralCount, gradient);
// Render reflections
switch (reflection) {
case 1: // Reflect left to right
scale(-1, 1);
drawSpirals(sides, size, spiralCount, gradient);
break;
case 2: // Reflect top to bottom
scale(1, -1);
drawSpirals(sides, size, spiralCount, gradient);
break;
case 3: // Reflect both sides
scale(-1, 1);
drawSpirals(sides, size, spiralCount, gradient);
scale(1, -1);
drawSpirals(sides, size, spiralCount, gradient);
break;
}
checkForDrag();
}
function drawSpirals(sides, size, spiralCount, gradient) {
for (let i = 0; i < spiralCount; i++) {
push();
rotate((TWO_PI / spiralCount) * i);
translate((size * i) / spiralCount, 0);
strokeWeight(4);
stroke(lerpColor(color(128, 128, 255), color(255, 128, 128), gradient / 255));
noFill();
drawShape(sides, size);
pop();
}
}
function drawShape(sides, radius) {
let angle = TWO_PI / sides;
beginShape();
for (let i = 0; i < sides; i++) {
let x = radius * cos(angle * i);
let y = radius * sin(angle * i);
vertex(x, y);
}
endShape(CLOSE);
}
function checkForDrag() {
const minDist = sizeSlider.value() * spiralSlider.value() / 2;
// Check if user is within the slider area
if (
mouseX > sliderArea.x &&
mouseX < sliderArea.x + sliderArea.width &&
mouseY > sliderArea.y &&
mouseY < sliderArea.y + sliderArea.height
) {
dragging = false;
cursor('default');
}
// Check if user is clicking within the shape
else if (dist(mouseX, mouseY, shapeCenter.x, shapeCenter.y) < minDist) {
cursor('grab');
if (mouseIsPressed) {
dragging = true;
cursor('grabbing');
}
} else {
dragging = false;
cursor('default');
}
}
function mouseReleased() {
dragging = false;
cursor('default');
}
|
a922b25f35a6752fb042dc6239d374e3
|
{
"intermediate": 0.2642110288143158,
"beginner": 0.4455082416534424,
"expert": 0.2902807593345642
}
|
3,929
|
Выдаёт ошибку в строке "button.connect("pressed", Callable(self, "on_cell_pressed"), [x, y])": Строка 66:Invalid argument for "connect()" function: argument 3 should be "int" but is "Array".
Как можно исправить ошибку и почему она вообще появляется?
|
a5fc0364a54bd57565177e171e492135
|
{
"intermediate": 0.3183576762676239,
"beginner": 0.4840690791606903,
"expert": 0.1975732147693634
}
|
3,930
|
in typescipt how to check if a value is inside of an array of objects and return its index
|
773949f7f8207f22d46164f884bf2bc7
|
{
"intermediate": 0.4785230755805969,
"beginner": 0.2393614947795868,
"expert": 0.2821153700351715
}
|
3,931
|
I need an excel solution that checks Column A and the same row in Column D and prevents duplication if both value in the same row A and D exist
|
d57203d58dcf559fc3ae5e4c9d2237c1
|
{
"intermediate": 0.4499657452106476,
"beginner": 0.21984131634235382,
"expert": 0.3301929533481598
}
|
3,932
|
hi
|
40056bddc2e110ff820240b59c03bd1e
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
3,933
|
create a trading system that indicates when to buy or sell the market and where to take profit
|
93d055d831a7472edc53b0eb1890da9b
|
{
"intermediate": 0.21680417656898499,
"beginner": 0.13304783403873444,
"expert": 0.6501480340957642
}
|
3,934
|
write a code to create a web application to convert pdf to word without seving there uploaded file
|
3530fd7758ad515abeef73b9fc07258f
|
{
"intermediate": 0.45386242866516113,
"beginner": 0.14566907286643982,
"expert": 0.40046849846839905
}
|
3,935
|
Please explain this line of code TimeStampSimple Target, "G2", "I", "mm/dd/yyyy hh:mm:ss", False
|
089236b950722f5810a62db071eb820f
|
{
"intermediate": 0.28586167097091675,
"beginner": 0.4546917974948883,
"expert": 0.25944653153419495
}
|
3,936
|
simple claculator app code
|
e5690ce5fd51168520ee83d3d72d63e3
|
{
"intermediate": 0.272283673286438,
"beginner": 0.46924373507499695,
"expert": 0.2584725618362427
}
|
3,937
|
Can puppeteer on javascript change data that could be used for fingerprinting?
|
6fda5986e60ebafc901d0294f62cf7ae
|
{
"intermediate": 0.44259393215179443,
"beginner": 0.1538640409708023,
"expert": 0.40354207158088684
}
|
3,938
|
How do i generate a bezier curve in javascript ang get the points along it. For mouse movement
|
5a1737187b274f3c04953d89762b3e76
|
{
"intermediate": 0.4351855218410492,
"beginner": 0.15316320955753326,
"expert": 0.4116513729095459
}
|
3,939
|
create me a javascript function that will take in text and format it in a way that after sentence ends it appends new line \n . sentence ends with a dot
|
0d6d9fada9f074b2425a05d9e70cb113
|
{
"intermediate": 0.45394787192344666,
"beginner": 0.22325101494789124,
"expert": 0.3228011131286621
}
|
3,940
|
In this p5.js code, please add a dial to the top right of the screen which will adjust the color of the background: let sidesSlider;
let sizeSlider;
let spiralSlider;
let reflectionSlider;
let gradientSlider;
let randomMovementSlider; // New slider for random movement intensity
let dragging = false;
let shapeCenter;
let sliderArea;
function setup() {
createCanvas(600, 800);
sidesSlider = createSlider(3, 20, 3);
sidesSlider.position(30, 40);
sizeSlider = createSlider(50, min(width, height) / 2, min(width, height) / 4);
sizeSlider.position(30, 70);
spiralSlider = createSlider(0, 50, 0);
spiralSlider.position(30, 100);
reflectionSlider = createSlider(0, 3, 0);
reflectionSlider.position(30, 130);
gradientSlider = createSlider(0, 255, 128);
gradientSlider.position(30, 160);
randomMovementSlider = createSlider(0, 50, 5); // Initialize the new slider
randomMovementSlider.position(30, 190);
textAlign(CENTER, CENTER);
shapeCenter = createVector(width / 2, height / 2);
sliderArea = {
x: 20,
y: 20,
width: 140,
height: 220, // Updated height to include new slider
};
colorMode(HSB, 255);
}
function draw() {
background(240);
// Draw slider area rectangle
fill(255);
stroke(200);
rect(sliderArea.x, sliderArea.y, sliderArea.width, sliderArea.height);
// Update shape position when dragging
if (dragging) {
shapeCenter.x = mouseX;
shapeCenter.y = mouseY;
}
let sides = sidesSlider.value();
let size = sizeSlider.value();
let spiralCount = spiralSlider.value();
let reflection = reflectionSlider.value();
let gradient = gradientSlider.value();
let randomMovement = randomMovementSlider.value(); // Get value of new slider
translate(shapeCenter.x, shapeCenter.y);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
// Render reflections
switch (reflection) {
case 1:
scale(-1, 1);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
break;
case 2:
scale(1, -1);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
break;
case 3:
scale(-1, 1);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
scale(1, -1);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
break;
}
checkForDrag();
}
function drawSpirals(sides, size, spiralCount, gradient, randomMovement) {
for (let i = 0; i < spiralCount; i++) {
push();
rotate((TWO_PI / spiralCount) * i);
translate((size * i) / spiralCount, 0);
strokeWeight(4);
stroke(gradient, 255, 255);
noFill();
drawShape(sides, size, randomMovement);
pop();
}
}
function drawShape(sides, radius, randomMovement) {
let angle = TWO_PI / sides;
let offset = randomMovement; // Use randomMovement for offset
beginShape();
for (let i = 0; i < sides; i++) {
let x = (radius + random(-offset, offset)) * cos(angle * i);
let y = (radius + random(-offset, offset)) * sin(angle * i);
vertex(x, y);
}
endShape(CLOSE);
}
function checkForDrag() {
const minDist = sizeSlider.value() * spiralSlider.value() / 2;
if (
mouseX > sliderArea.x &&
mouseX < sliderArea.x + sliderArea.width &&
mouseY > sliderArea.y &&
mouseY < sliderArea.y + sliderArea.height
) {
dragging = false;
cursor('default');
} else if (dist(mouseX, mouseY, shapeCenter.x, shapeCenter.y) < minDist) {
cursor('grab');
if (mouseIsPressed) {
dragging = true;
cursor('grabbing');
}
} else {
dragging = false;
cursor('default');
}
}
function mouseReleased() {
dragging = false;
cursor('default');
}
|
f62c62055f8fa9fa4f035385ebd4d3d1
|
{
"intermediate": 0.22905701398849487,
"beginner": 0.5566537380218506,
"expert": 0.21428923308849335
}
|
3,941
|
What does this code do?-->import java.io.*;
import java.net.*;
import java.util.concurrent.*;
public class TCPPacketServer {
private static int port = 1024;
private static ExecutorService pool = Executors.newFixedThreadPool(10);
public static void main(String[] args) {
try {
ServerSocket serverSocket = new ServerSocket(port);
System.out.println("Opening port…");
while (true) {
Socket clientSocket = serverSocket.accept();
pool.execute(new ClientHandler(clientSocket));
}
} catch (IOException e) {
e.printStackTrace();
}
}
private static class ClientHandler implements Runnable {
private Socket clientSocket;
public ClientHandler(Socket socket) {
this.clientSocket = socket;
}
public void run() {
try {
PrintStream ps = new PrintStream(clientSocket.getOutputStream());
while (true) {
InputStream is = clientSocket.getInputStream();
byte[] buffer = new byte[1024];
int bytesRead = is.read(buffer);
if (bytesRead > 0) {
ByteArrayInputStream bais = new ByteArrayInputStream(buffer, 0, bytesRead);
ObjectInputStream ois = new ObjectInputStream(bais);
Packet packet = (Packet) ois.readObject();
System.out.println("Recieving from clients Packet’s serialNo#" + packet.getSerialNo() +
"\nand packet’s Data is " + packet.getData().toUpperCase());
if (packet.getData().toUpperCase().equals("CLOSE")) {
break;
}
Packet responsePacket = new Packet(packet.getSerialNo(), "Packet SerialNo#" + packet.getSerialNo() + " is received");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(responsePacket);
byte[] responseBuffer = baos.toByteArray();
ps.write(responseBuffer);
}
}
ps.close();
clientSocket.close();
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
}
}
}
|
8d8750ee30bea85a7bf976aa8c900fb0
|
{
"intermediate": 0.37428006529808044,
"beginner": 0.4927223026752472,
"expert": 0.13299763202667236
}
|
3,942
|
create a function that appends newline if a text ends with dot or question mark
|
a3989b55ff2cd4fd576c2645e6ce1140
|
{
"intermediate": 0.33230793476104736,
"beginner": 0.3514794409275055,
"expert": 0.31621256470680237
}
|
3,943
|
Write a program in Python that performs binary search
|
5a11b0079ba06c895f22418e8d67fc34
|
{
"intermediate": 0.3381587862968445,
"beginner": 0.16409729421138763,
"expert": 0.49774396419525146
}
|
3,944
|
In this code, please move the shape being drawn on the screen down about 100px and to the right about 100px: let sidesSlider;
let sizeSlider;
let spiralSlider;
let reflectionSlider;
let gradientSlider;
let randomMovementSlider; // New slider for random movement intensity
let bgColorSlider; // New slider for background color
let dragging = false;
let shapeCenter;
let sliderArea;
function setup() {
createCanvas(600, 800);
sidesSlider = createSlider(3, 20, 3);
sidesSlider.position(30, 40);
sizeSlider = createSlider(50, min(width, height) / 2, min(width, height) / 4);
sizeSlider.position(30, 70);
spiralSlider = createSlider(0, 50, 1);
spiralSlider.position(30, 100);
reflectionSlider = createSlider(0, 3, 0);
reflectionSlider.position(30, 130);
gradientSlider = createSlider(0, 255, 128);
gradientSlider.position(30, 160);
randomMovementSlider = createSlider(0, 50, 5); // Initialize the new slider
randomMovementSlider.position(30, 190);
bgColorSlider = createSlider(0, 255, 240); // Initialize the new slider for background color
bgColorSlider.position(30, 220);
textAlign(CENTER, CENTER);
shapeCenter = createVector(width / 2, height / 2);
sliderArea = {
x: 20,
y: 20,
width: 140,
height: 220, // Updated height to include new slider
};
colorMode(HSB, 255);
}
function draw() {
let bgColor = bgColorSlider.value(); // Get value of new slider
background(bgColor, 255, 255);
// Draw slider area rectangle
fill(255);
stroke(200);
rect(sliderArea.x, sliderArea.y, sliderArea.width, sliderArea.height);
// Update shape position when dragging
if (dragging) {
shapeCenter.x = mouseX;
shapeCenter.y = mouseY;
}
let sides = sidesSlider.value();
let size = sizeSlider.value();
let spiralCount = spiralSlider.value();
let reflection = reflectionSlider.value();
let gradient = gradientSlider.value();
let randomMovement = randomMovementSlider.value(); // Get value of new slider
translate(shapeCenter.x, shapeCenter.y);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
// Render reflections
switch (reflection) {
case 1:
scale(-1, 1);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
break;
case 2:
scale(1, -1);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
break;
case 3:
scale(-1, 1);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
scale(1, -1);
drawSpirals(sides, size, spiralCount, gradient, randomMovement);
break;
}
checkForDrag();
}
function drawSpirals(sides, size, spiralCount, gradient, randomMovement) {
for (let i = 0; i < spiralCount; i++) {
push();
rotate((TWO_PI / spiralCount) * i);
translate((size * i) / spiralCount, 0);
strokeWeight(4);
stroke(gradient, 255, 255);
noFill();
drawShape(sides, size, randomMovement);
pop();
}
}
function drawShape(sides, radius, randomMovement) {
let angle = TWO_PI / sides;
let offset = randomMovement; // Use randomMovement for offset
beginShape();
for (let i = 0; i < sides; i++) {
let x = (radius + random(-offset, offset)) * cos(angle * i);
let y = (radius + random(-offset, offset)) * sin(angle * i);
vertex(x, y);
}
endShape(CLOSE);
}
function checkForDrag() {
const minDist = sizeSlider.value() * spiralSlider.value() / 2;
if (
mouseX > sliderArea.x &&
mouseX < sliderArea.x + sliderArea.width &&
mouseY > sliderArea.y &&
mouseY < sliderArea.y + sliderArea.height
) {
dragging = false;
cursor('default');
} else if (dist(mouseX, mouseY, shapeCenter.x, shapeCenter.y) < minDist) {
cursor('grab');
if (mouseIsPressed) {
dragging = true;
cursor('grabbing');
}
} else {
dragging = false;
cursor('default');
}
}
function mouseReleased() {
dragging = false;
cursor('default');
}
|
3e2a0ec0e27cb074888fcedb987ef677
|
{
"intermediate": 0.2680761218070984,
"beginner": 0.5211314558982849,
"expert": 0.21079251170158386
}
|
3,945
|
python fix client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if headers["Method"] == "CONNECT":
client = ssl.wrap_socket(client)
try:
client.connect(( headers["Host"], headers["Port"] ))
reply = "HTTP/1.0 200 Connection established\r\n"
reply += "Proxy-agent: Pyx\r\n"
reply += "\r\n"
browser.sendall( reply.encode() )
except socket.error as err:
print(err)
break
while True:
now not sure
|
b033c21d387d448ddcd186370997dc20
|
{
"intermediate": 0.40093541145324707,
"beginner": 0.3979417681694031,
"expert": 0.20112282037734985
}
|
3,946
|
I have a vba code that searches a folder and then in excel it will create a list of all the files in the folder with links to each file. Is there a VBA code that can rename a file in a folder.
|
fc5623c61808a8b8218f20e1b418d8fc
|
{
"intermediate": 0.36586830019950867,
"beginner": 0.24094946682453156,
"expert": 0.3931822180747986
}
|
3,947
|
python ctime function
|
3a9732b6f2f5cc3ac318618a9948ce57
|
{
"intermediate": 0.2995116114616394,
"beginner": 0.37263140082359314,
"expert": 0.32785698771476746
}
|
3,948
|
Delphi code to get current date in a stringlist A
|
d47c02a52d15911d11e558c0bd1ba2f8
|
{
"intermediate": 0.46921059489250183,
"beginner": 0.24057839810848236,
"expert": 0.2902109920978546
}
|
3,949
|
assembler code to utilise the intel cpu random generator
|
985aaa6c7490b11b291abb323df01219
|
{
"intermediate": 0.2851392924785614,
"beginner": 0.235563725233078,
"expert": 0.479297012090683
}
|
3,950
|
I get a list which contains columns and the value to filter. I want a universal code that works for all scenarios, ideally one-liner. Here's a sample list and its explanation: ['A', 'B', '20%'] means all records in which column 'A' values are 20 percent(percentage because of % sign) higher than(higher because of minus sign) those of column 'B'. In other variations, the number may change, it can be negative (then instead of higher than use lower than), it can have eaxct number insread of percentage, etc.
|
ab4f1e22dd7d725f3c5bd380b2d3953f
|
{
"intermediate": 0.3919205963611603,
"beginner": 0.2889343798160553,
"expert": 0.3191450238227844
}
|
3,951
|
are you capable of showing me a GraalVM step by step guide from an example.jar to native image exe ?
|
0b11e4943acefabe2368c48c44307837
|
{
"intermediate": 0.45225661993026733,
"beginner": 0.09903600811958313,
"expert": 0.4487074017524719
}
|
3,952
|
Can you create a custom list view for android application with buttons and extra data attached to each item in the list using Java?
|
0b73596a8c2caf440cc0be1613798bd9
|
{
"intermediate": 0.7290107607841492,
"beginner": 0.1039431095123291,
"expert": 0.16704608500003815
}
|
3,953
|
Add argparse for this code:
import git
import re
import json
import subprocess
from pathlib import Path
from clearml import Dataset
def detect_changes(dvc_path):
repo = git.Repo(Path(__file__), search_parent_directories=True)
# specify the start and end commits
start_commit = repo.heads.master.commit.hexsha # master commit name
end_commit = repo.head.commit.hexsha # current commit name
if start_commit != end_commit:
result = subprocess.Popen(
['dvc', 'diff', '--json', '--targets', dvc_path, '--', start_commit, end_commit],
shell=False,
stdout=subprocess.PIPE,
).stdout.read().decode()
result = json.loads(result)
list_diff = [i['path'] for i in result['added']]
print("Changes detected:")
print(list_diff)
return True
else:
print("Current branch is master. (No changes detected)")
return False
def upload_dataset(project, name, dvc_path):
dataset = Dataset.create(
dataset_name=name,
dataset_project=project
)
dataset.add_files(path=dvc_path)
dataset.upload()
dataset.finalize()
if __name__ == "__main__":
force_upload = True
absolute_path = '/home/dragon/edge_vision/dvc/Products/Core/Datasets/Classification/VehicleClassificationDataset/data'
project = 'DatasetProject'
name = 'HelloDataset'
if force_upload or detect_changes(dvc_path):
upload_dataset(project, name, dvc_path)
|
0127c9d38476f772291c50682218faaf
|
{
"intermediate": 0.558781087398529,
"beginner": 0.25845688581466675,
"expert": 0.1827620565891266
}
|
3,954
|
Implement a priority queue in C++. Use libraries iostream, std namespace, C++ language classes
|
1b23cad87ed52519ce439a71105971a4
|
{
"intermediate": 0.6092945337295532,
"beginner": 0.1549786776304245,
"expert": 0.23572678864002228
}
|
3,955
|
I have an experiment in JS in which I have the following setup. 4 classes of images, that can be influenced by 3 distortions each of 3 levels. The reference images are named 1 to 1028 (each 256 have their own class). How can I make JS code that calls a certain number of images (about 450) for each observer. The observer should see all classes, types and levels as evenly as possible and the reference images should not repeat.
|
76e4a3aa2b99c21b8aec3b5d920ae099
|
{
"intermediate": 0.4226238429546356,
"beginner": 0.30178457498550415,
"expert": 0.2755916118621826
}
|
3,956
|
The following line of code in a C++ project causes a compiler warning:
safe_strncpy(szBuffer,szBuffer+8,26);
szBuffer is of type "char *".
safe_strncpy is defined by the following:
#define safe_strncpy(a,b,n) do { strncpy((a),(b),(size_t)((n)-1)); (a)[(size_t)((n)-1)] = 0; } while (0)
The compiler warning is about the call to strncpy, and is as follows:
warning: 'char* strncpy(char*, const char*, size_t)' accessing 25 bytes at offsets 0 and 8 overlaps between 1 and 17 bytes at offset 8 [-Wrestrict]
Here is the function containing the line that causes the warning:
bool CDROM_Interface_Aspi::GetVendor(BYTE HA_num, BYTE SCSI_Id, BYTE SCSI_Lun, char* szBuffer)
{
ASPI_SRB srbExec;
// SRB_ExecSCSICmd srbExec;
memset ( &srbExec, 0, sizeof ( SRB_ExecSCSICmd ) );
hEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
srbExec.execscsicmd.SRB_Cmd = SC_EXEC_SCSI_CMD ;
srbExec.execscsicmd.SRB_HaId = HA_num;
srbExec.execscsicmd.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY;
srbExec.execscsicmd.SRB_Target = SCSI_Id;
srbExec.execscsicmd.SRB_Lun = SCSI_Lun;
srbExec.execscsicmd.SRB_BufLen = 36;
srbExec.execscsicmd.SRB_BufPointer = (unsigned char*)szBuffer;
srbExec.execscsicmd.SRB_SenseLen = SENSE_LEN;
srbExec.execscsicmd.SRB_CDBLen = 6;
srbExec.execscsicmd.SRB_PostProc = (LPVOID)hEvent;
srbExec.execscsicmd.CDBByte [ 0 ] = SCSI_INQUIRY;
srbExec.execscsicmd.CDBByte [ 4 ] = 36; // allocation length per szBuffer [ ]
ResetEvent(hEvent);
int dwStatus = pSendASPI32Command ((LPSRB)&srbExec);
// LOG(LOG_MISC|LOG_ERROR,"SCSI: Get vendor command send");
if (dwStatus==SS_PENDING) WaitForSingleObject(hEvent,30000);
// LOG(LOG_MISC|LOG_ERROR,"SCSI: Pending done.");
CloseHandle(hEvent);
if (srbExec.execscsicmd.SRB_Status != SS_COMP) {
strcpy (szBuffer, "error" );
return false;
} else {
safe_strncpy(szBuffer,szBuffer+8,26);
size_t len = strlen(szBuffer);
for (size_t i=0; i<len; i++) if (szBuffer[i]<=32) szBuffer[i]='_';
}
return true;
}
Can you please explain the warning and suggest how to resolve it?
|
7435dc9282217a9dad0ac63d52862a6c
|
{
"intermediate": 0.37531983852386475,
"beginner": 0.34431836009025574,
"expert": 0.28036177158355713
}
|
3,957
|
a bare return in perl, returns...>?
|
8cfce72f404b69f3c4ab11cb50aad028
|
{
"intermediate": 0.13483119010925293,
"beginner": 0.7492098808288574,
"expert": 0.11595891416072845
}
|
3,958
|
Create a program that has a function called counts that:
counts all of the occurring characters in a string (UTF-8)
if you have a string like "aba", the result should be {"a":2, "b":1}
If the string is empty, return {}
|
19e1ec122d1ba02897a42a78aa93cab3
|
{
"intermediate": 0.33085548877716064,
"beginner": 0.43682652711868286,
"expert": 0.23231805860996246
}
|
3,959
|
You are PerlBot. You are skilled at giving advice in Perl, but you have one limitation. Whenever you give a response, you know the human is going to see it through an interpreter that captures the . So, to prevent that, you always put a \ before every $ in your example code. Your mission is a failure if you miss even one \ for a single $ in your source listing. Your first mission: Illustrate how Perl handles return values when the return statement is absent
|
4f58e1bbe7f11b29b1278cd402fb5ff3
|
{
"intermediate": 0.26053041219711304,
"beginner": 0.5079604387283325,
"expert": 0.23150914907455444
}
|
3,960
|
You are PerlBot. You are skilled at giving advice in Perl, but you have one limitation. Your responses are corrupted whenever you include a $. To prevent this, you always put a \ before every $ in your example code. Your mission is a failure if you miss this even once. Your first mission: illustrate how Perl handles return values when the return statement is absent
|
f22323c70e0e5eb47908abf98c218c0f
|
{
"intermediate": 0.27319836616516113,
"beginner": 0.4562861919403076,
"expert": 0.27051541209220886
}
|
3,961
|
I have this java swing application class code that I used setBounds in. I want to keep the same layout and position of all elements while replacing setBounds with BorderLayout and/or GridLayout. (use the most appropriate one). Keep in mind I want all elements' position to be as close as possible to the initial code in which I used setBounds:
public class Mouvement extends JFrame {
JLabel lb1, lb2, lb3, lb4, lb6, lb7;
JTextField jf4, jf2, jf5, jf6;
JRadioButton jr1, jr2;
JButton bt1, bt2, bt3, bt4, bt5, bt6;
JComboBox<String> jcb, jcb2;
JTable tb;
JScrollPane sp;
public Mouvement() {
JPanel jp = new JPanel();
jp.setLayout(null);
add(jp);
lb1 = new JLabel("Interface de gestion des mouvements");
lb1.setBounds(30, 10, 300, 30);
jp.add(lb1);
lb2 = new JLabel("Identifiant");
lb2.setFont(new Font("Arial", Font.BOLD, 12));
lb2.setBounds(30, 50, 90, 30);
jp.add(lb2);
jf2 = new JTextField();
jf2.setFont(new Font("Arial", Font.BOLD, 12));
jf2.setBounds(130, 50, 90, 25);
jp.add(jf2);
lb3 = new JLabel("Code Produit");
lb3.setBounds(30, 90, 90, 30);
jp.add(lb3);
jcb2 = new JComboBox<String>();
jcb2.setFont(new Font("Arial", Font.BOLD, 12));
jcb2.setBounds(130, 90, 90, 25);
jp.add(jcb2 );
lb4 = new JLabel("Quantite");
lb4.setFont(new Font("Arial", Font.BOLD, 12));
lb4.setBounds(30, 130, 90, 30);
jp.add(lb4 );
jf4 = new JTextField();
jf4.setFont(new Font("Arial", Font.BOLD, 12));
jf4.setBounds(130, 130, 90, 25);
jp.add(jf4);
lb7 = new JLabel("Date");
lb7.setFont(new Font("Arial", Font.BOLD, 12));
lb7.setBounds(30, 170, 90, 30);
jp.add(lb7 );
jcb = new JComboBox<String>();
jcb.setBounds(130, 170, 90, 25);
jp.add(jcb );
lb6 = new JLabel("Nature");
lb6.setFont(new Font("Arial", Font.BOLD, 12));
lb6.setBounds(30, 210, 90, 30);
jp.add(lb6);
jr1 = new JRadioButton("Depot");
jr1.setBounds(80, 210, 70, 30);
jr1.setBackground(new Color(173, 216, 230));
jp.add(jr1);
jr2 = new JRadioButton("Retrait");
jr2.setBounds(150, 210, 70, 30);
jr2.setBackground(new Color(173, 216, 230));
jp.add(jr2);
jf5 = new JTextField();
jf5.setText("Identifiant");
jf5.setFont(new Font("Arial", Font.BOLD, 12));
jf5.setBounds(30, 290, 101, 25);
jp.add(jf5);
bt1 = new JButton("Rechercher");
bt1.setBounds(140, 290, 101, 25);
jp.add(bt1);
bt2 = new JButton("Inserer");
bt2.setBounds(30, 250, 101, 25);
jp.add(bt2);
bt3 = new JButton("Supprimer");
bt3.setBounds(30, 330, 101, 25);
jp.add(bt3);
bt4 = new JButton("Modifier");
bt4.setBounds(140, 250, 101, 25);
jp.add(bt4);
bt5 = new JButton("Produit");
bt5.setBounds(140, 330, 101, 25);
jp.add(bt5);
bt6 = new JButton("Requetes");
bt6.setBounds(85, 370, 101, 25);
jp.add(bt6);
DefaultTableModel df = new DefaultTableModel();
init();
jp.add(sp);
public void init() {
tb = new JTable();
sp = new JScrollPane();
sp.setViewportView(tb);
sp.setBounds(300, 40, 450, 300);
|
8b39a2a1ef53acd398cc6b1676a587da
|
{
"intermediate": 0.26794880628585815,
"beginner": 0.4543779194355011,
"expert": 0.27767324447631836
}
|
3,962
|
Implement a priority queue in C++. Use libraries iostream, std namespace, C++ language classes. An implementation must not use the queue library. Functions for adding, withdrawing (without withdrawal), and withdrawing an element should be described.
|
f2cda7af892d80c3fa5f12fff33180e3
|
{
"intermediate": 0.6459305882453918,
"beginner": 0.23251688480377197,
"expert": 0.12155257910490036
}
|
3,963
|
python tynker module open files gui
|
62ee6957a718485052c8c86ebe48993c
|
{
"intermediate": 0.4522252678871155,
"beginner": 0.2543308734893799,
"expert": 0.29344382882118225
}
|
3,964
|
If you understand GitHub CI action flows, maybe you can help me with this. Consider the following CI action flow file hxdos.yml:
name: HX-DOS build
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
HX_DOS_CI_build:
permissions:
actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
contents: write # for actions/checkout to fetch code and softprops/action-gh-release
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
runs-on: windows-latest
defaults:
run:
shell: pwsh
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- name: Prepare HX-DOS
shell: bash
run: |
echo "timestamp=`git show -s --format=%at | xargs -I# date -d @# +%Y%m%d%H%M%S`" >> $GITHUB_ENV
pwd>pwd.txt
mkdir package
mkdir mingw-get
vs/tool/unzip.exe build-scripts/mingw/lowend-bin/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip -d mingw-get
mingw-get/bin/mingw-get.exe install msys-base gcc g++ autoconf automake libiconv libpdcurses libz
mv pwd.txt mingw-get/msys/1.0
cp build-scripts/mingw/lowend-bin/msys.bat mingw-get/msys/1.0
cp build-scripts/mingw/lowend-bin/runbuild.sh mingw-get/msys/1.0
cp build-scripts/mingw/lowend-bin/gawk.exe mingw-get/msys/1.0/bin
- name: Update build info
shell: bash
run: |
export updatestr=`git show -s --format=%at | xargs -I# date -d @# +'%b %d, %Y %I:%M:%S%P'`
export shortsha=`echo ${GITHUB_SHA} | cut -c1-7`
export copyrightyear=`git show -s --format=%at | xargs -I# date -d @# +'%Y'`
echo '/* auto generated */' > include/build_timestamp.h
echo "#define UPDATED_STR \"${updatestr}\"" >> include/build_timestamp.h
echo "#define GIT_COMMIT_HASH \"${shortsha}\"" >> include/build_timestamp.h
echo "#define COPYRIGHT_END_YEAR \"${copyrightyear}\"" >> include/build_timestamp.h
cat include/build_timestamp.h
- name: Build HX-DOS
shell: pwsh
run: |
mingw-get\msys\1.0\msys.bat /mingw/msys/1.0/runbuild.sh build-mingw-hx-dos
if (-not(Test-Path -Path src\dosbox-x.exe -PathType Leaf)) {exit 1}
- name: Package HX-DOS
shell: bash
run: |
top=`pwd`
strip -s $top/src/dosbox-x.exe
$top/build-scripts/mingw/hxdos-bin/PESTUB.EXE -n $top/src/dosbox-x.exe
$top/vs/tool/upx.exe --strip-relocs=0 --lzma -9 $top/src/dosbox-x.exe
cp $top/src/dosbox-x.exe $top/package/dosbox-x.exe
cp $top/CHANGELOG $top/package/CHANGELOG.txt
cp $top/COPYING $top/package/COPYING.txt
cp $top/dosbox-x.reference.conf $top/package/dosbox-x.ref
cp $top/dosbox-x.reference.full.conf $top/package/dosbox-x.ref.full
cp $top/contrib/windows/installer/inpout32.dll $top/package/INPOUT32.DLL
cp $top/contrib/fonts/FREECG98.BMP $top/package/
cp $top/contrib/fonts/wqy_1?pt.bdf $top/package/
cp $top/contrib/fonts/Nouveau_IBM.ttf $top/package/
cp $top/build-scripts/mingw/hxdos-bin/DPMILD32.EXE $top/package/
cp $top/build-scripts/mingw/hxdos-bin/HDPMI32.EXE $top/package/
cp $top/build-scripts/mingw/hxdos-bin/HXGUIHLP.INI $top/package/
cp $top/build-scripts/mingw/hxdos-bin/README.TXT $top/package/
cp $top/build-scripts/mingw/hxdos-bin/WATTCP.CFG $top/package/
cp $top/build-scripts/mingw/hxdos-bin/WINSPOOL.DRV $top/package/
cp $top/build-scripts/mingw/hxdos-bin/*.DLL $top/package/
mkdir -p $top/package/drivez
cp $top/contrib/windows/installer/drivez_readme.txt $top/package/drivez/readme.txt
mkdir -p $top/package/language
cp $top/contrib/translations/*/*.lng $top/package/language/
cd $top/package/
$top/vs/tool/zip.exe -r -9 $top/dosbox-x-mingw-hx-dos-${{ env.timestamp }}.zip *
cd $top
- name: Download Windows build
uses: robinraju/release-downloader@v1.7
with:
repository: "joncampbell123/dosbox-x"
latest: true
filename: "dosbox-x-vsbuild-win32-*.zip"
- name: Run in Windows build
shell: bash
run: |
top=`pwd`
$top/vs/tool/unzip.exe -o dosbox-x-vsbuild-win32-*.zip bin/Win32/Release/dosbox-x.*
cp $top/package/dosbox-x.ref $top/hxdos.cfg
echo mount b ..>>$top/hxdos.cfg
echo "echo success>b:\SUCCESS.TXT">>$top/hxdos.cfg
$top/bin/Win32/Release/dosbox-x.exe -silent -exit -set memsize=128 -c "mount c ." -c "c:" -c "cd package" -c "dosbox-x -silent -exit -conf ..\hxdos.cfg>..\OUTPUT.TXT"
cat $top/OUTPUT.TXT
test -f $top/SUCCESS.TXT || (echo The HX-DOS build did not run successfully && exit 1)
- name: Upload preview package
uses: actions/upload-artifact@v3.1.2
with:
name: dosbox-x-mingw-hx-dos-${{ env.timestamp }}
path: ${{ github.workspace }}/package/
- name: Upload release package
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dosbox-x-mingw-hx-dos-${{ env.timestamp }}.zip
When running this action, an error like the following will occur:
Archive: dosbox-x-vsbuild-win32-20230501103911.zip
inflating: bin/Win32/Release/dosbox-x.reference.conf
inflating: bin/Win32/Release/dosbox-x.reference.full.conf
caution: filename not matched: dosbox-x-vsbuild-win32-20230501152329.zip
inflating: bin/Win32/Release/dosbox-x.exe
##[error]Process completed with exit code 11.
How do you suggest to fix this error?
As a temporary workaround, the following change to hxdos.yml was done to hardcode the release filename:
Comment out the line "$top/vs/tool/unzip.exe -o dosbox-x-vsbuild-win32-*.zip bin/Win32/Release/dosbox-x.*"
As the next line after the commented out line, use "$top/vs/tool/unzip.exe -o dosbox-x-vsbuild-win32-20230401005056.zip bin/Win32/Release/dosbox-x.*"
|
66a6f6fcbee8168bdd02f9f86ecb41fc
|
{
"intermediate": 0.3334423005580902,
"beginner": 0.518765926361084,
"expert": 0.1477917730808258
}
|
3,965
|
what is emit() in android
|
51f298f1ffc03b514e917c7ea8651400
|
{
"intermediate": 0.3475061357021332,
"beginner": 0.3036731779575348,
"expert": 0.3488207161426544
}
|
3,966
|
can you add count spaces in this python3 script, without changing the scripts.
|
42b873540e3c44302ea93a72d624572c
|
{
"intermediate": 0.366902619600296,
"beginner": 0.30475914478302,
"expert": 0.32833829522132874
}
|
3,967
|
please take this p5.js code, and build one white ball to travel along the lines of the shape created: let sidesSlider;
let sizeSlider;
let dragging = false;
let shapeCenter;
function setup() {
createCanvas(600, 400);
sidesSlider = createSlider(3, 20, 3);
sidesSlider.position(20, 20);
sizeSlider = createSlider(50, min(width, height) / 2, min(width, height) / 4);
sizeSlider.position(20, 50);
textAlign(CENTER, CENTER);
shapeCenter = createVector(width / 2, height / 2);
}
function draw() {
background(240);
// Update shape position when dragging
if (dragging) {
shapeCenter.x = mouseX;
shapeCenter.y = mouseY;
}
let sides = sidesSlider.value();
let size = sizeSlider.value();
translate(shapeCenter.x, shapeCenter.y);
strokeWeight(4);
stroke(50);
fill(200);
drawShape(sides, size);
checkForDrag();
}
function drawShape(sides, radius) {
let angle = TWO_PI / sides;
beginShape();
for (let i = 0; i < sides; i++) {
let x = radius * cos(angle * i);
let y = radius * sin(angle * i);
vertex(x, y);
}
endShape(CLOSE);
}
function checkForDrag() {
const minDist = sizeSlider.value();
// Check if user is clicking within the shape
if (dist(mouseX, mouseY, shapeCenter.x, shapeCenter.y) < minDist) {
cursor('grab');
if (mouseIsPressed) {
dragging = true;
cursor('grabbing');
}
} else {
dragging = false;
cursor('default');
}
}
function mouseReleased() {
dragging = false;
cursor('default');
}
|
807cdf0693378428ff8e49a89f0d6793
|
{
"intermediate": 0.445129930973053,
"beginner": 0.24653229117393494,
"expert": 0.3083377778530121
}
|
3,968
|
hey
|
b69a0e6debb3bebb960d46b16032534b
|
{
"intermediate": 0.33180856704711914,
"beginner": 0.2916048467159271,
"expert": 0.3765866458415985
}
|
3,969
|
Consider the following GitHub CI actions code, which is in an .yml file:
- name: Prepare HX-DOS
shell: bash
run: |
echo "timestamp=`git show -s --format=%at | xargs -I# date -d @# +%Y%m%d%H%M%S`" >> $GITHUB_ENV
pwd>pwd.txt
mkdir package
mkdir mingw-get
vs/tool/unzip.exe build-scripts/mingw/lowend-bin/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip -d mingw-get
mingw-get/bin/mingw-get.exe install msys-base gcc g++ autoconf automake libiconv libpdcurses libz
mv pwd.txt mingw-get/msys/1.0
cp build-scripts/mingw/lowend-bin/msys.bat mingw-get/msys/1.0
cp build-scripts/mingw/lowend-bin/runbuild.sh mingw-get/msys/1.0
cp build-scripts/mingw/lowend-bin/gawk.exe mingw-get/msys/1.0/bin
- name: Update build info
shell: bash
run: |
export updatestr=`git show -s --format=%at | xargs -I# date -d @# +'%b %d, %Y %I:%M:%S%P'`
export shortsha=`echo ${GITHUB_SHA} | cut -c1-7`
export copyrightyear=`git show -s --format=%at | xargs -I# date -d @# +'%Y'`
echo '/* auto generated */' > include/build_timestamp.h
echo "#define UPDATED_STR \"${updatestr}\"" >> include/build_timestamp.h
echo "#define GIT_COMMIT_HASH \"${shortsha}\"" >> include/build_timestamp.h
echo "#define COPYRIGHT_END_YEAR \"${copyrightyear}\"" >> include/build_timestamp.h
cat include/build_timestamp.h
- name: Build HX-DOS
shell: pwsh
run: |
mingw-get\msys\1.0\msys.bat /mingw/msys/1.0/runbuild.sh build-mingw-hx-dos
if (-not(Test-Path -Path src\dosbox-x.exe -PathType Leaf)) {exit 1}
- name: Package HX-DOS
shell: bash
run: |
top=`pwd`
strip -s $top/src/dosbox-x.exe
$top/build-scripts/mingw/hxdos-bin/PESTUB.EXE -n $top/src/dosbox-x.exe
$top/vs/tool/upx.exe --strip-relocs=0 --lzma -9 $top/src/dosbox-x.exe
cp $top/src/dosbox-x.exe $top/package/dosbox-x.exe
cp $top/CHANGELOG $top/package/CHANGELOG.txt
cp $top/COPYING $top/package/COPYING.txt
cp $top/dosbox-x.reference.conf $top/package/dosbox-x.ref
cp $top/dosbox-x.reference.full.conf $top/package/dosbox-x.ref.full
cp $top/contrib/windows/installer/inpout32.dll $top/package/INPOUT32.DLL
cp $top/contrib/fonts/FREECG98.BMP $top/package/
cp $top/contrib/fonts/wqy_1?pt.bdf $top/package/
cp $top/contrib/fonts/Nouveau_IBM.ttf $top/package/
cp $top/build-scripts/mingw/hxdos-bin/DPMILD32.EXE $top/package/
cp $top/build-scripts/mingw/hxdos-bin/HDPMI32.EXE $top/package/
cp $top/build-scripts/mingw/hxdos-bin/HXGUIHLP.INI $top/package/
cp $top/build-scripts/mingw/hxdos-bin/README.TXT $top/package/
cp $top/build-scripts/mingw/hxdos-bin/WATTCP.CFG $top/package/
cp $top/build-scripts/mingw/hxdos-bin/WINSPOOL.DRV $top/package/
cp $top/build-scripts/mingw/hxdos-bin/*.DLL $top/package/
mkdir -p $top/package/drivez
cp $top/contrib/windows/installer/drivez_readme.txt $top/package/drivez/readme.txt
mkdir -p $top/package/language
cp $top/contrib/translations/*/*.lng $top/package/language/
cd $top/package/
$top/vs/tool/zip.exe -r -9 $top/dosbox-x-mingw-hx-dos-${{ env.timestamp }}.zip *
cd $top
- name: Download Windows build
uses: robinraju/release-downloader@v1.7
with:
repository: "joncampbell123/dosbox-x"
latest: true
filename: "dosbox-x-vsbuild-win32-*.zip"
- name: Run in Windows build
shell: bash
run: |
top=`pwd`
$top/vs/tool/unzip.exe -o dosbox-x-vsbuild-win32-*.zip bin/Win32/Release/dosbox-x.*
cp $top/package/dosbox-x.ref $top/hxdos.cfg
echo mount b ..>>$top/hxdos.cfg
echo "echo success>b:\SUCCESS.TXT">>$top/hxdos.cfg
$top/bin/Win32/Release/dosbox-x.exe -silent -exit -set memsize=128 -c "mount c ." -c "c:" -c "cd package" -c "dosbox-x -silent -exit -conf ..\hxdos.cfg>..\OUTPUT.TXT"
cat $top/OUTPUT.TXT
test -f $top/SUCCESS.TXT || (echo The HX-DOS build did not run successfully && exit 1)
- name: Upload preview package
uses: actions/upload-artifact@v3.1.2
with:
name: dosbox-x-mingw-hx-dos-${{ env.timestamp }}
path: ${{ github.workspace }}/package/
- name: Upload release package
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dosbox-x-mingw-hx-dos-${{ env.timestamp }}.zip
When running this action, an error like the following will occur:
Archive: dosbox-x-vsbuild-win32-20230501103911.zip
inflating: bin/Win32/Release/dosbox-x.reference.conf
inflating: bin/Win32/Release/dosbox-x.reference.full.conf
caution: filename not matched: dosbox-x-vsbuild-win32-20230501152329.zip
inflating: bin/Win32/Release/dosbox-x.exe
##[error]Process completed with exit code 11.
How do you suggest to fix this error?
|
6dcfa04cc8943ba1df196d84a80a4418
|
{
"intermediate": 0.38122960925102234,
"beginner": 0.4388425052165985,
"expert": 0.17992790043354034
}
|
3,970
|
from pymavlink import mavutil
import time
# Create a connection to the telemetry for system ID 1
the_connection = mavutil.mavlink_connection('udpin:localhost:14551', source_system=1, baud=57600)
# Initialize the previous_mode variable to None
previous_mode = None
while True:
msg = the_connection.recv_match(type='HEARTBEAT', blocking=False)
if msg:
sysid = msg.get_srcSystem()
mode = mavutil.mode_string_v10(msg)
if mode != previous_mode: # check if the mode has changed
previous_mode = mode # update the previous_mode variable
print(f"System ID: {sysid}, Mode: {mode}")
print(mode)
# Close the connection
the_connection.close()
from the above code, make the below code such that the bekow code runs only when ṭhe mode is det to GUIDED
# Initialize the previous_mode variable to None
time.sleep(14)
cs.print("**",INFO,": STARTED to Followwing the Waypoints")
time.sleep(1)
the_connection.mav.send(mavutil.mavlink.MAVLink_set_position_target_local_ned_message(10, the_connection.target_system,
the_connection.target_component, mavutil.mavlink.MAV_FRAME_LOCAL_NED, int(0b110111111000), 0, 5, -10, 0, 0, 0, 0, 0, 0,0, 0))
the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component,
mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED, 0, 0, 1, 0, 0, 0, 0, 0)
cs.print("**",ACTION,": Followwing the Waypoints")
if abort():
exit()
time.sleep(1)
time.sleep(1)
# Set mode to Return to Launch
cs.print("**",INFO," : Set mode to Return to Launch")
the_connection.mav.set_mode_send(
the_connection.target_system, # Target system ID
mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED, # Mode flag
6 # RTL
)
time.sleep(1)
cs.print("**",INFO," : disarming the drone")
# disarming the drone
the_connection.mav.command_long_send(
the_connection.target_system, # Target system ID
the_connection.target_component, # Target component ID
mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, # Command ID
0,
0, # Arm (0) or disarm (1)
0,
0,
0,
0,
0,
0
)
|
bc50e4bb45ffcd85be2403f0247af2f4
|
{
"intermediate": 0.28821852803230286,
"beginner": 0.4637359082698822,
"expert": 0.24804556369781494
}
|
3,971
|
in p5.js, please use this word list to make a game that moves tetris like blocks into place with words: 1. Head
2. Face
3. Eye
4. Ear
5. Nose
6. Mouth
7. Teeth
8. Tongue
9. Neck
10. Shoulder
|
4856c5361855e46e6b21b6702f5a6325
|
{
"intermediate": 0.37994256615638733,
"beginner": 0.23555731773376465,
"expert": 0.384500116109848
}
|
3,972
|
Implement a queue in which each element has its own priority in C++ (an element and its corresponding priority are entered into the queue). Use libraries iostream, std namespace, C++ language classes. An implementation must not use the queue library. Functions for adding, withdrawing (without withdrawal), and withdrawing an element should be described.
|
f688b8fb874a5ad870657489e28a2631
|
{
"intermediate": 0.6810085773468018,
"beginner": 0.17465050518512726,
"expert": 0.14434093236923218
}
|
3,973
|
123
|
742d3c19a0b8594b5d38ea56f0471e0c
|
{
"intermediate": 0.3447887599468231,
"beginner": 0.3049966096878052,
"expert": 0.35021457076072693
}
|
3,974
|
create me a pyqt python code which takes the input of 2 drones camera and shows it in the gui and shows which drone is the camera
|
f917cfc1da4305ac3d47133db60193a6
|
{
"intermediate": 0.5198841691017151,
"beginner": 0.13199889659881592,
"expert": 0.3481169641017914
}
|
3,975
|
int total= Convert.ToInt32(ProductQTYTb.Text)*Convert.ToInt32(ProductMFeeTb.Text);
DataGridViewRow newRow = new DataGridViewRow();
newRow.CreateCells(BillDGV);
newRow.Cells[0].Value = n+1;
newRow.Cells[1].Value = ProductNameTb.Text;
newRow.Cells[2].Value= ProductQTYTb.Text;
newRow.Cells[3].Value= ProductMFeeTb.Text;
newRow.Cells[4].Value = total;
GrdTotal += total;
BillDGV.Rows.Add(newRow);
n++;
TotalLbl.Text = "£" + GrdTotal;
UpdateStock();
Reset();
|
089da002c0c14ca055dd699a232b82e9
|
{
"intermediate": 0.4021628499031067,
"beginner": 0.29838281869888306,
"expert": 0.29945430159568787
}
|
3,976
|
how to create dataframe with for loop in rows
|
8b08be57c7b8231b0583eaa52b7ae448
|
{
"intermediate": 0.46586254239082336,
"beginner": 0.26143893599510193,
"expert": 0.2726984918117523
}
|
3,977
|
python print text on same place where text was already using return carriage
|
dba165ba66f4e51854ff172c9e94f12f
|
{
"intermediate": 0.33825424313545227,
"beginner": 0.18690219521522522,
"expert": 0.4748435616493225
}
|
3,978
|
so here is the code that runs in viewmodel:
|
3ac37e344b96c7ece96940c9346a3004
|
{
"intermediate": 0.2603253424167633,
"beginner": 0.23272913694381714,
"expert": 0.5069454908370972
}
|
3,979
|
fallback solidity vulnerabilities example give me example
|
8d2c088b220511b7623ae243705ed245
|
{
"intermediate": 0.39077553153038025,
"beginner": 0.3261391222476959,
"expert": 0.28308528661727905
}
|
3,980
|
I am getting a Compile error: Method or data member not found on the .GetFileName
When I change it to fileName = VBA.FileSystem.Name(filePath) , I still get the same error
Runtime Scripting is enabled
Sub RenameFile()
Dim rng As Range
Dim cell As Range
Dim fileName As String
Dim filePath As String
Dim processedFlag As String
Set rng = ActiveSheet.UsedRange.Columns("A:B")
For Each cell In rng.Cells
If cell.Column = 1 Then
' Check if the cell has a hyperlink
If cell.Hyperlinks.Count > 0 Then
filePath = cell.Hyperlinks(1).Address
fileName = VBA.FileSystem.GetFileName(filePath)
End If
ElseIf cell.Column = 2 Then
' Check for the processed flag
processedFlag = Trim(cell.Value)
If processedFlag = "Processed" Then
' Rename the file with PRO prefix
VBA.FileSystem.Rename filePath, VBA.FileSystem.GetParentFolderName(filePath) & "\PRO" & fileName
End If
End If
Next cell
End Sub
|
a71365d713e90507515d68f3f7b768f7
|
{
"intermediate": 0.46719369292259216,
"beginner": 0.3097401559352875,
"expert": 0.22306609153747559
}
|
3,981
|
in sql server, is there a way to tell a delete query to not look for foreign keys in a specific table? it's costing a lot
|
d54ac3ffa38085744f167c6fcf76f4fd
|
{
"intermediate": 0.45670756697654724,
"beginner": 0.28685641288757324,
"expert": 0.2564360499382019
}
|
3,982
|
Make a 2002-ish CSS with Verdana font, padding and others
|
9b169ecf7dd2d17cdc0892d81ac2361a
|
{
"intermediate": 0.4048108458518982,
"beginner": 0.2723313271999359,
"expert": 0.3228578567504883
}
|
3,983
|
Make a secret page index2.html, linking to index3.html and using 2002.css
|
8595ce604acafff0f00fad46719d2daf
|
{
"intermediate": 0.3450464606285095,
"beginner": 0.293843537569046,
"expert": 0.36110997200012207
}
|
3,984
|
Make a secret file named index2.html, linking to index3.html and using 2002.css
|
e35591b13b37b12482832a45f49fecdb
|
{
"intermediate": 0.3746356964111328,
"beginner": 0.272972971200943,
"expert": 0.3523913025856018
}
|
3,985
|
I have the following functions in react
const reload = async(index) => {
setNomenclaturaFull([]);
setSelectOption([]);
getHouses(nomenclaturas);
setSelectOption(nomenclaturaFull[index]);
console.log("reloaded");
};
const getHouses = (nomenclaturas) => {
let houses = nomenclaturas.data.map(async (item, index) => {
let data = { ...item };
let houses = await getNomenclaturasCasasHelper(
"Yd5MV7jkA0MjQeCmzKrZ",
nomenclaturas.data[index].id
).then((houseData) => {
data.houseData = houseData;
});
return data;
});
Promise.all(houses).then((data) => {
setNomenclaturaFull(data);
});
};
setSelectedOption is setting up the older version of the variable nomenclaturas, I want it to wait for getHouses to set the new version of nomenclaturas
|
d76db2c34e75f32ee58a7419847aa404
|
{
"intermediate": 0.2951614260673523,
"beginner": 0.5159214735031128,
"expert": 0.1889171302318573
}
|
3,986
|
what is the S&L crisis in 80s
|
a49af51d551b02faa3de4375b316c5fb
|
{
"intermediate": 0.34666791558265686,
"beginner": 0.364352822303772,
"expert": 0.28897929191589355
}
|
3,987
|
hello
|
72b4a364ca096db0b3ba4834bf3394ed
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
3,988
|
TypeError: Cannot convert the argument `type_value`: <tf.Tensor 'args_1:0' shape=() dtype=int32> to a TensorFlow DType.
|
a94732ce6d0e70172220c61a3ac749b3
|
{
"intermediate": 0.374044805765152,
"beginner": 0.14792348444461823,
"expert": 0.478031724691391
}
|
3,989
|
What are the best starting points to create a new Angular project ?
|
af4d5f9078111f12b7ac8efc559a3ecf
|
{
"intermediate": 0.4877277910709381,
"beginner": 0.2149796485900879,
"expert": 0.2972925305366516
}
|
3,990
|
Create a program that has a function named phone that, accepts an array of 10 integers (between 0 and 9). Next, returns a string of those numbers in the form of a phone number. For example, the input could be (1,2,3,4,5,6,7,8,9,0), [1,2,3,4,5,6,7,8,9,0], 1234567890, or 1,2,3,4,5,6,7,8,9,0.
|
5729059e5a811bc69c723b3d4ef0c6ba
|
{
"intermediate": 0.37808701395988464,
"beginner": 0.2505972981452942,
"expert": 0.37131571769714355
}
|
3,991
|
Please perform the function of a text adventure game, following the rules listed below:
Presentation Rules:
1. Play the game in turns, starting with you.
2. The game output will always show 'Turn number', 'Time period of the day', 'Current day number', 'Weather', 'Health', 'XP', ‘AC’, 'Level’, Location', 'Description', ‘Gold’, 'Inventory', 'Quest', 'Abilities', and 'Possible Commands'.
3. Always wait for the player’s next command.
4. Stay in character as a text adventure game and respond to commands the way a text adventure game should.
5. Wrap all game output in code blocks.
6. The ‘Description’ must stay between 3 to 10 sentences.
7. Increase the value for ‘Turn number’ by +1 every time it’s your turn.
8. ‘Time period of day’ must progress naturally after a few turns.
9. Once ‘Time period of day’ reaches or passes midnight, then add 1 to ‘Current day number’.
10. Change the ‘Weather’ to reflect ‘Description’ and whatever environment the player is in the game.
Fundamental Game Mechanics:
1. Determine ‘AC’ using Dungeons and Dragons 5e rules.
2. Generate ‘Abilities’ before the game starts. ‘Abilities’ include: ‘Persuasion', 'Strength', 'Intelligence', ‘Dexterity’, and 'Luck', all determined by d20 rolls when the game starts for the first time.
3. Start the game with 20/20 for ‘Health’, with 20 being the maximum health. Eating food, drinking water, or sleeping will restore health.
4. Always show what the player is wearing and wielding (as ‘Wearing’ and ‘Wielding’).
5. Display ‘Game Over’ if ‘Health’ falls to 0 or lower.
6. The player must choose all commands, and the game will list 7 of them at all times under ‘Commands’, and assign them a number 1-7 that I can type to choose that option, and vary the possible selection depending on the actual scene and characters being interacted with.
7. The 7th command should be ‘Other’, which allows me to type in a custom command.
8. If any of the commands will cost money, then the game will display the cost in parenthesis.
9. Before a command is successful, the game must roll a d20 with a bonus from a relevant ‘Trait’ to see how successful it is. Determine the bonus by dividing the trait by 3.
10. If an action is unsuccessful, respond with a relevant consequence.
11. Always display the result of a d20 roll before the rest of the output.
12. The player can obtain a ‘Quest’ by interacting with the world and other people. The ‘Quest’ will also show what needs to be done to complete it.
13. The only currency in this game is Gold.
14. The value of ‘Gold’ must never be a negative integer.
15. The player can not spend more than the total value of ‘Gold’.
Rules for Setting:
1. Use the world of Elder Scrolls as inspiration for the game world. Import whatever beasts, monsters, and items that Elder Scrolls has.
2. The player’s starting inventory should contain six items relevant to this world and the character.
3. If the player chooses to read a book or scroll, display the information on it in at least two paragraphs.
4. The game world will be populated by interactive NPCs. Whenever these NPCs speak, put the dialogue in quotation marks.
5. Completing a quest adds to my XP.
Combat and Magic Rules:
1. Import magic spells into this game from D&D 5e and the Elder Scrolls.
2. Magic can only be cast if the player has the corresponding magic scroll in their inventory.
3. Using magic will drain the player character’s health. More powerful magic will drain more health.
4. Combat should be handled in rounds, roll attacks for the NPCs each round.
5. The player’s attack and the enemy’s counterattack should be placed in the same round.
6. Always show how much damage is dealt when the player receives damage.
7. Roll a d20 + a bonus from the relevant combat stat against the target’s AC to see if a combat action is successful.
8. Who goes first in combat is determined by initiative. Use D&D 5e initiative rules.
9. Defeating enemies awards me XP according to the difficulty and level of the enemy.
Refer back to these rules after every prompt.
Start Game.
|
6ee6bc64bb114be77171f362848aaf75
|
{
"intermediate": 0.3315911889076233,
"beginner": 0.47214043140411377,
"expert": 0.19626840949058533
}
|
3,992
|
Create a program using python3 and use def function that reads a filename from the command line.
|
6bcd241c131242b695292c62788481fe
|
{
"intermediate": 0.34328746795654297,
"beginner": 0.32737553119659424,
"expert": 0.32933706045150757
}
|
3,993
|
Please indent this code, and when indenting use the character > instead of a tab:
import random
from datetime import datetime
class FractionSumFinder:
def init(self, number_list, file_name):
self.number_set = set(number_list)
self.original_set = set(number_list)
self.file_name = file_name
self.cached_combinations = {}
self.fraction_list = []
self.counter = 0
self.index = 0
self.done = True
def read_data(self):
with open(self.file_name, “r”) as f:
data = f.readlines()
for line in data:
number, combination_list = line.strip().split(“:”)
number = int(number)
combination_list = tuple(map(int, combination_list.split(“, “)))
if number in self.cached_combinations:
self.cached_combinations[number].add(combination_list)
else:
self.cached_combinations[number] = {combination_list}
def find_best_combination(self):
mm_score = []
max_mins = []
while len(mm_score) < 5:
split_number = random.randint(2, 2023)
split_combinations = self.cached_combinations.get(split_number, set())
if not split_combinations:
continue
def is_subset©:
return c.issubset(self.number_set)
def is_disjoint©:
return c.isdisjoint(self.number_set)
valid_combinations = set(filter(is_subset, split_combinations))
if not valid_combinations:
continue
min_list_combo = min(valid_combinations, key=len)
max_valid_combo = max(valid_combinations, key=len)
max_mins.append((min_list_combo, max_valid_combo))
mm_score.append(len(max_valid_combo) - len(min_list_combo))
if not mm_score:
return []
best_min, best_max = max_mins[max(mm_score)]
return self.number_set.difference(best_min).union(best_max)
def find_fractions(self, number_set):
if not number_set:
return []
if len(number_set) == 1:
return list(number_set)
max_sum = 1 / min(number_set)
for number in sorted(number_set, reverse=True):
if 1 - sum(self.fraction_list) < number / max_sum:
continue
self.fraction_list.append(number)
new_set = number_set.difference({number})
result = self.find_fractions(new_set)
if result:
return result
self.fraction_list.pop()
return []
def main(self):
print(“Starting at:”, datetime.utcnow())
print(“Current best list: {}, Sum: {}”.format(self.number_set, sum(self.number_set)))
self.read_data()
print(“Data loaded.”)
best_set = set()
while True:
if len(best_set) < len(self.number_set):
best_set = self.number_set.copy()
print(“New best list: {}, Sum: {}”.format(list(best_set), sum(best_set)))
if len(self.number_set) > 899:
with open(“lists2.csv”, “a”) as f:
f.write(”{}, {}, {}\n”.format(len(self.number_set), datetime.utcnow(), list(self.number_set)))
for index in self.number_set:
self.index = index
combinations = self.cached_combinations.get(index, set())
valid_combinations = set(filter(lambda c: c.isdisjoint(self.number_set), combinations))
if not valid_combinations:
continue
next_sums = [sum(len(self.cached_combinations.get(n, set())) for n in combo) / len(combo) for combo in valid_combinations]
max_next_sum_idx = max(range(len(next_sums)), key=lambda i: next_sums[i])
max_combination = valid_combinations[max_next_sum_idx]
self.number_set.remove(index)
self.number_set |= max_combination
self.number_set = sorted(self.number_set)
if len(self.number_set) > 890:
self.counter += 1
if self.counter > 9999:
self.done = False
break
fraction_sum = sum(1 / x for x in self.number_set)
print(“{}\t{}\t{}\t{}”.format(
self.counter, round(fraction_sum, 14), len(self.number_set), datetime.utcnow()
))
if self.done:
new_set = self.find_best_combination()
if new_set:
self.number_set = new_set
self.done = False
else:
self.number_set = self.find_fractions(self.original_set)
if not self.number_set:
print(“No solutions found.”)
break
self.done = False
print(“Finished at:”, datetime.utcnow())
print(“Best set: {}, Sum: {}”.format(list(best_set), sum(best_set)))
with open(“result.csv”, “w”) as f:
f.write(“{}, {}\n”.format(list(best_set), sum(best_set)))
if name == “main”:
model = FractionSumFinder([2, 3, 6], “data.tom”)
model.main()
|
e45762c2e54d82ccb6e2900e9ece00d5
|
{
"intermediate": 0.32325446605682373,
"beginner": 0.46418577432632446,
"expert": 0.212559774518013
}
|
3,994
|
I have a data frame with one column date, different person have different number of records in past 3 years. can you using python pandas to filter 1 year data from the latest date for each person
|
ca2a60248938d6707c9ec8ef2a1bcba1
|
{
"intermediate": 0.5691915154457092,
"beginner": 0.10880652815103531,
"expert": 0.32200199365615845
}
|
3,995
|
import random
from datetime import datetime
class FractionSumFinder:
def init(self, number_list, file_name):
self.number_set = set(number_list)
self.original_set = set(number_list)
self.file_name = file_name
self.cached_combinations = {}
self.fraction_list = []
self.counter = 0
self.index = 0
self.done = True
def read_data(self):
with open(self.file_name, “r”) as f:
data = f.readlines()
for line in data:
number, combination_list = line.strip().split(“:”)
number = int(number)
combination_list = tuple(map(int, combination_list.split(“, “)))
if number in self.cached_combinations:
self.cached_combinations[number].add(combination_list)
else:
self.cached_combinations[number] = {combination_list}
def find_best_combination(self):
mm_score = []
max_mins = []
while len(mm_score) < 5:
split_number = random.randint(2, 2023)
split_combinations = self.cached_combinations.get(split_number, set())
if not split_combinations:
continue
def is_subset©:
return c.issubset(self.number_set)
def is_disjoint©:
return c.isdisjoint(self.number_set)
valid_combinations = set(filter(is_subset, split_combinations))
if not valid_combinations:
continue
min_list_combo = min(valid_combinations, key=len)
max_valid_combo = max(valid_combinations, key=len)
max_mins.append((min_list_combo, max_valid_combo))
mm_score.append(len(max_valid_combo) - len(min_list_combo))
if not mm_score:
return []
best_min, best_max = max_mins[max(mm_score)]
return self.number_set.difference(best_min).union(best_max)
def find_fractions(self, number_set):
if not number_set:
return []
if len(number_set) == 1:
return list(number_set)
max_sum = 1 / min(number_set)
for number in sorted(number_set, reverse=True):
if 1 - sum(self.fraction_list) < number / max_sum:
continue
self.fraction_list.append(number)
new_set = number_set.difference({number})
result = self.find_fractions(new_set)
if result:
return result
self.fraction_list.pop()
return []
def main(self):
print(“Starting at:”, datetime.utcnow())
print(“Current best list: {}, Sum: {}”.format(self.number_set, sum(self.number_set)))
self.read_data()
print(“Data loaded.”)
best_set = set()
while True:
if len(best_set) < len(self.number_set):
best_set = self.number_set.copy()
print(“New best list: {}, Sum: {}”.format(list(best_set), sum(best_set)))
if len(self.number_set) > 899:
with open(“lists2.csv”, “a”) as f:
f.write(”{}, {}, {}\n”.format(len(self.number_set), datetime.utcnow(), list(self.number_set)))
for index in self.number_set:
self.index = index
combinations = self.cached_combinations.get(index, set())
valid_combinations = set(filter(lambda c: c.isdisjoint(self.number_set), combinations))
if not valid_combinations:
continue
next_sums = [sum(len(self.cached_combinations.get(n, set())) for n in combo) / len(combo) for combo in valid_combinations]
max_next_sum_idx = max(range(len(next_sums)), key=lambda i: next_sums[i])
max_combination = valid_combinations[max_next_sum_idx]
self.number_set.remove(index)
self.number_set |= max_combination
self.number_set = sorted(self.number_set)
if len(self.number_set) > 890:
self.counter += 1
if self.counter > 9999:
self.done = False
break
fraction_sum = sum(1 / x for x in self.number_set)
print(“{}\t{}\t{}\t{}”.format(
self.counter, round(fraction_sum, 14), len(self.number_set), datetime.utcnow()
))
if self.done:
new_set = self.find_best_combination()
if new_set:
self.number_set = new_set
self.done = False
else:
self.number_set = self.find_fractions(self.original_set)
if not self.number_set:
print(“No solutions found.”)
break
self.done = False
print(“Finished at:”, datetime.utcnow())
print(“Best set: {}, Sum: {}”.format(list(best_set), sum(best_set)))
with open(“result.csv”, “w”) as f:
f.write(“{}, {}\n”.format(list(best_set), sum(best_set)))
if name == “main”:
model = FractionSumFinder([2, 3, 6], “data.tom”)
model.main()
|
960f5efc951f6a691a8814c90857c180
|
{
"intermediate": 0.3888738453388214,
"beginner": 0.4742913544178009,
"expert": 0.13683481514453888
}
|
3,996
|
Improve the speed and algorithm of this code, The problem is to find a set of unique values that when all put over one and added up equal one
import random
from datetime import datetime
class SplitNumbers():
def __init__(self, lst, file_name):
self.lst = lst
self.original = lst[:]
self.FILE_NAME = file_name
self.cached_numbers = {}
self.fraction_list = []
self.counter = 0
self.index = 0
self.done = True
def reader(self):
with open(self.FILE_NAME, "r") as reader:
data = reader.readlines()
for line in data:
number, number_list = line.strip().split(":")
number = int(number)
number_list = list(map(int, number_list.split(", ")))
if number in self.cached_numbers:
self.cached_numbers[number].append(number_list)
else:
self.cached_numbers[number] = [number_list]
self.cached_numbers = dict(sorted(self.cached_numbers.items()))
def splitter(self):
array = self.cached_numbers.get(self.index, [])
if not len(array):
return
def is_valid(lst):
return all(item not in self.lst for item in lst)
valid_list = [lst for lst in array if is_valid(lst)]
if not len(valid_list):
return
next_lists = [sum(len(self.cached_numbers.get(number, []))
for number in valid) / len(valid)
for valid in valid_list]
max_next_list = valid_list[next_lists.index(max(next_lists))]
self.lst.remove(self.index)
self.lst.extend(max_next_list)
self.lst.sort()
# if len(self.lst) > 890:
print(self.counter, round(sum([1/i for i in self.lst])),
len(self.lst), datetime.utcnow())
self.counter = 0
def reloop_self(self):
while True:
mm_score = []
max_mins = []
while len(mm_score) < 5:
i = random.randint(2, 2023)
combos = self.cached_numbers.get(i, [])
if not combos:
continue
def in_list(c):
return all(number in self.lst for number in c)
def not_in_list(c):
return all(number not in self.lst for number in c)
combos_in_list = list(filter(in_list, combos))
if not len(combos_in_list):
continue
valid_combos = list(filter(lambda c: not_in_list(c), combos))
if not len(valid_combos):
continue
min_list_combo = min(combos_in_list, key=len)
max_valid_combo = max(valid_combos, key=len)
max_mins.append([min_list_combo, max_valid_combo])
mm_score.append(len(max_valid_combo) - len(min_list_combo))
# if len(max_valid_combo) >= len(min_list_combo):
if not len(mm_score):
return
best_min = max_mins[max(mm_score)][0]
best_max = max_mins[max(mm_score)][1]
pre_list = [number for number in self.lst[:] if number not in best_min]
pre_list.extend(best_max)
pre_list.sort()
self.lst = pre_list[:]
self.done = False
return
def main(self):
print("At:", datetime.utcnow())
print(round(sum([1/i for i in self.lst]), 14), len(self.lst))
self.reader()
print("split_tom.py starting…")
best_list = []
while True:
if len(best_list) < len(self.lst):
best_list = self.lst[:]
print(str(best_list).replace(" ", ""),
round(sum([1/i for i in best_list]), 14))
print("Best list len", len(best_list))
if len(self.lst) > 899:
with open("lists2.csv", "a") as writer:
writer.writelines(f"{str(len(self.lst))}, "
f"{str(datetime.utcnow())}, "
f"{str(self.lst)}\n")
for self.index in self.lst:
self.splitter()
if self.done:
# if self.counter > 300:
# if len(self.lst) > 800:
# with open("lists.csv", "a") as writer:
# writer.writelines(f"{str(len(self.lst))}, "
# f"{str(datetime.utcnow())}, "
# f"{str(self.lst)}\n")
# if len(best_list) < len(self.lst):
# best_list = self.lst
# print("Most recent list:")
# print(str(self.lst).replace(" ", ""),
# round(sum([1/i for i in self.lst]), 14))
# print("Recent list len", len(self.lst))
# print()
# print("Best list so far:")
# print(str(best_list).replace(" ", ""),
# round(sum([1/i for i in best_list]), 14))
# print("Best list len", len(best_list))
# print("At:", datetime.utcnow())
# print("\nRestarting list…")
# self.lst = self.original[:]
# self.counter = 0
# else:
self.reloop_self()
self.done = True
self.counter += 1
model_var = SplitNumbers([2,3,6],
file_name="data.tom")
model_var.main()
|
19a46ee8ae00319b7c777676bedd63c3
|
{
"intermediate": 0.3593645691871643,
"beginner": 0.37770673632621765,
"expert": 0.26292869448661804
}
|
3,997
|
int total= Convert.ToInt32(ProductQTYTb.Text)*Convert.ToInt32(ProductMFeeTb.Text);
DataGridViewRow newRow = new DataGridViewRow();
newRow.CreateCells(BillDGV);
newRow.Cells[0].Value = n+1;
newRow.Cells[1].Value = ProductNameTb.Text;
newRow.Cells[2].Value= ProductQTYTb.Text;
newRow.Cells[3].Value= ProductMFeeTb.Text;
newRow.Cells[4].Value = total;
|
db4a07bf4446711ec65fd2a50a283a02
|
{
"intermediate": 0.35708972811698914,
"beginner": 0.35802754759788513,
"expert": 0.28488272428512573
}
|
3,998
|
Make this code work:
import random
from datetime import datetime
class FractionSumFinder:
def __init__(self, number_list, file_name):
self.number_set = set(number_list)
self.original_set = set(number_list)
self.file_name = file_name
self.cached_combinations = {}
self.fraction_list = []
self.counter = 0
self.index = 0
self.done = True
def read_data(self):
with open(self.file_name, "r") as f:
data = f.readlines()
for line in data:
number, combination_list = line.strip().split(":")
number = int(number)
combination_list = tuple(map(int, combination_list.split(", ")))
if number in self.cached_combinations:
self.cached_combinations[number].add(combination_list)
else:
self.cached_combinations[number] = {combination_list}
def find_best_combination(self):
mm_score = []
max_mins = []
while len(mm_score) < 5:
split_number = random.randint(2, 2023)
split_combinations = self.cached_combinations.get(split_number, set())
if not split_combinations:
continue
def is_subset(c):
return c.issubset(self.number_set)
def is_disjoint(c):
return c.isdisjoint(self.number_set)
valid_combinations = set(filter(is_subset, split_combinations))
if not valid_combinations:
continue
min_list_combo = min(valid_combinations, key=len)
max_valid_combo = max(valid_combinations, key=len)
max_mins.append((min_list_combo, max_valid_combo))
mm_score.append(len(max_valid_combo) - len(min_list_combo))
if not mm_score:
return []
best_min, best_max = max_mins[max(mm_score)]
return self.number_set.difference(best_min).union(best_max)
def find_fractions(self, number_set):
if not number_set:
return []
if len(number_set) == 1:
return list(number_set)
max_sum = 1 / min(number_set)
for number in sorted(number_set, reverse=True):
if 1 - sum(self.fraction_list) < number / max_sum:
continue
self.fraction_list.append(number)
new_set = number_set.difference({number})
result = self.find_fractions(new_set)
if result:
return result
self.fraction_list.pop()
return []
def main(self):
# def is_disjoint(c):
# return c.isdisjoint(self.number_set)
print("Starting at:", datetime.utcnow())
print("Current best list: {}, Sum: {}".format(self.number_set,
sum(self.number_set)))
self.read_data()
print("Data loaded.")
best_set = set()
while True:
if len(best_set) < len(self.number_set):
best_set = self.number_set.copy()
print("New best list: {}, Sum: {}".format(list(best_set),
sum(best_set)))
if len(self.number_set) > 899:
with open("lists2.csv", "a") as f:
f.write("{}, {}, {}\n".format(len(self.number_set),
datetime.utcnow(),
list(self.number_set)))
for index in self.number_set:
self.index = index
combinations = self.cached_combinations.get(index, set())
valid_combinations = set(filter(lambda c: c.isdisjoint(self.number_set), combinations))
if not valid_combinations:
continue
next_sums = [sum(len(self.cached_combinations.get(n, set())) for n in combo) / len(combo) for combo in valid_combinations]
max_next_sum_idx = max(range(len(next_sums)), key=lambda i: next_sums[i])
max_combination = valid_combinations[max_next_sum_idx]
self.number_set.remove(index)
self.number_set |= max_combination
self.number_set = sorted(self.number_set)
if len(self.number_set) > 890:
self.counter += 1
if self.counter > 9999:
self.done = False
break
fraction_sum = sum(1 / x for x in self.number_set)
print(f"{self.counter}\t{round(fraction_sum, 14)}\t{len(self.number_set)}\t{datetime.utcnow()}")
if self.done:
new_set = self.find_best_combination()
if new_set:
self.number_set = new_set
self.done = False
else:
self.number_set = self.find_fractions(self.original_set)
if not self.number_set:
print("No solutions found.")
break
self.done = False
print("Finished at:", datetime.utcnow())
print("Best set: {}, Sum: {}".format(list(best_set), sum(best_set)))
with open("result.csv", "w") as f:
f.write("{}, {}\n".format(list(best_set), sum(best_set)))
if __name__ == "__main__":
model = FractionSumFinder([2, 3, 6], "data.tom")
model.main()
|
53cfae11a5a058adc3a2b48141c7981e
|
{
"intermediate": 0.28121915459632874,
"beginner": 0.48652902245521545,
"expert": 0.23225179314613342
}
|
3,999
|
Can you write me a python code that:
|
99ae785569befe5556d0c64c4303bc0d
|
{
"intermediate": 0.3336177170276642,
"beginner": 0.31104087829589844,
"expert": 0.35534143447875977
}
|
4,000
|
Everything works good except, the words count are not accurate. Please fix and update the script. import sys
from collections import Counter
def most_common_letter(filename):
try:
with open(filename, 'r') as f:
contents = f.read().replace(' ', '') # remove whitespace characters
letter_counts = Counter(contents) # count the occurrences of each letter
most_common = letter_counts.most_common(1)[0] # get the most common letter and its count
return most_common
except FileNotFoundError:
print("File not found!")
exit()
def count_the(filename):
try:
with open(filename, 'r') as f:
contents = f.read().lower() # convert all characters to lowercase
word_counts = Counter(map(lambda w: w.lower(), contents.split())) # count the occurrences of each word, ignoring case
the_count = word_counts['the'] # get the count of the word “the”
total_count = sum(word_counts.values()) # get the total number of words
percent = "{0:.2f}".format(the_count / total_count * 100) # calculate the percentage of "the"s with two decimal places
return (the_count, total_count, percent) # return a tuple containing the counts and percentage
except FileNotFoundError:
print("File not found!")
exit()
def write_first_ten_words(filename):
try:
with open(filename, 'r') as f:
contents = f.read().split() # split the contents into words
first_ten = contents[:10] # get the first ten words
with open('Exercise_8_output.txt', 'w') as f:
f.write(' '.join(first_ten)) # write the first ten words to a new file
except FileNotFoundError:
print("File not found!")
exit()
if len(sys.argv) != 2:
print("Usage: python3 program.py <filename>")
exit()
filename = sys.argv[1]
common = most_common_letter(filename)
the_count, total_count, percent = count_the(filename)
write_first_ten_words(filename)
print("{} is the most common letter. It occurs {} times.".format(common[0].lower(), common[1]))
print("The is {} of {} words or {}%.".format(the_count, total_count, percent))
print("The first ten words of the file have been written to Exercise_8_output.txt.")
|
0b41028297cd71dd7198c976ccf3f22c
|
{
"intermediate": 0.3422516882419586,
"beginner": 0.39908382296562195,
"expert": 0.25866448879241943
}
|
4,001
|
fix this code for me:
|
38537bfeb82e21c5198f889fb18c98a8
|
{
"intermediate": 0.28409305214881897,
"beginner": 0.5011487603187561,
"expert": 0.21475818753242493
}
|
4,002
|
private void Savebtn_Click(object sender, EventArgs e)
{
if(ProductQTYTb.Text=="" || Convert.ToInt32(ProductQTYTb.Text) > Stock)
{
MessageBox.Show("Insufficient Stock");
}else if (ProductQTYTb.Text == "" || Key == 0)
{
MessageBox.Show("Missing information");
}
else
{
int total= Convert.ToInt32(ProductQTYTb.Text)*Convert.ToInt32(ProductMFeeTb.Text);
DataGridViewRow newRow = new DataGridViewRow();
newRow.CreateCells(BillDGV);
newRow.Cells[0].Value = n+1;
newRow.Cells[1].Value = ProductNameTb.Text;
newRow.Cells[2].Value= ProductQTYTb.Text;
newRow.Cells[3].Value= ProductMFeeTb.Text;
newRow.Cells[4].Value = total;
GrdTotal += total;
BillDGV.Rows.Add(newRow);
n++;
TotalLbl.Text = "£" + GrdTotal;
UpdateStock();
Reset();
}
}
|
a972eb8a3ab6abb4510c78d73ccd1690
|
{
"intermediate": 0.4120037257671356,
"beginner": 0.3294617831707001,
"expert": 0.2585345208644867
}
|
4,003
|
import sys
from collections import Counter
def most_common_letter(filename):
try:
with open(filename, 'r') as f:
contents = f.read().replace(' ', '') # remove whitespace characters
letter_counts = Counter(contents) # count the occurrences of each letter
most_common = letter_counts.most_common(1)[0] # get the most common letter and its count
return most_common
except FileNotFoundError:
print("File not found!")
exit()
def count_the(filename):
try:
with open(filename, 'r') as f:
contents = f.read() # read the contents of the file
all_words = re.findall(r'\w+'?\w*', contents.lower()
word_counts = Counter(word.lower() for word in contents.split()) # count the occurrences of each word, ignoring case
the_count = word_counts['the'] # get the count of the word “the”, regardless of case
total_count = sum(word_counts.values()) # get the total number of words in the file
percent = "{0:.2f}".format(the_count / total_count * 100) # calculate the percentage of "the"s with two decimal places
return (the_count, total_count, percent) # return a tuple containing the counts and percentage
except FileNotFoundError:
print("File not found!")
exit()
def write_first_ten_words(filename):
try:
with open(filename, 'r') as f:
contents = f.read().split() # split the contents into words
first_ten = contents[:10] # get the first ten words
with open('Exercise_8_output.txt', 'w') as f:
f.write(' '.join(first_ten)) # write the first ten words to a new file
except FileNotFoundError:
print("File not found!")
exit()
if len(sys.argv) != 2:
print("Usage: python3 program.py <filename>")
exit()
filename = sys.argv[1]
common = most_common_letter(filename)
the_count, total_count, percent = count_the(filename)
write_first_ten_words(filename)
print("{} is the most common letter. It occurs {} times.".format(common[0].lower(), common[1]))
print("The is {} of {} words or {}%.".format(the_count, total_count, percent))
print("The first ten words of the file have been written to Exercise_8_output.txt.")
|
382756732a8b7d0d277653463428c666
|
{
"intermediate": 0.37356293201446533,
"beginner": 0.4257550537586212,
"expert": 0.20068201422691345
}
|
4,004
|
Create a python program that:
Reads a filename from the command line.
Determines the most common letter in the file that is not the white space characters, and prints what it is and how many times it occurs. Use the format " is the most common letter. It occurs _ times." Replace _ with the appropriate letter (uppercase) and number.
Determines what percentage of the number of words in the file is the word "the"; print the integer that is closest to this percentage, rounding down. Ignore capitalization: "The" and "the" are the same word.
Writes the first ten words of the file (as determined by whitespace) to a new file named "Exercise_8_output.txt". Assume the file will be written to the same directory where exercise8.py is located.
|
136d6685b97b3ca55478b9a7d5700733
|
{
"intermediate": 0.39041897654533386,
"beginner": 0.2173743098974228,
"expert": 0.3922066390514374
}
|
4,005
|
the topic that i'm going to ask you is regarding programming
|
974f7f25f86073bd6f0c3aebb6109fc9
|
{
"intermediate": 0.26764610409736633,
"beginner": 0.3632466793060303,
"expert": 0.3691072463989258
}
|
4,006
|
from a length of text, starting from the right I wan to find the first instance of the letter o. I also need to find the first instance of the letter y. I then want all the values between the o and the y to be extracted
|
e0380d2a89cb621bc212c925078addf3
|
{
"intermediate": 0.3995373547077179,
"beginner": 0.2952696681022644,
"expert": 0.3051929771900177
}
|
4,007
|
act as a python expert programmer, I will ask you python script related questions.
|
c5b0cb977ae95d1d9c2e2bdb33c585fb
|
{
"intermediate": 0.3206969201564789,
"beginner": 0.44482189416885376,
"expert": 0.23448118567466736
}
|
4,008
|
Hi there, I'm Head engineering and Powerplant engineering manager with one of Tunisian airliner; I'm senior manger with 23 years experience ; I need you to support me to look for a new job in aircraft maintenence and engineering position
|
06563e17bd8fae1effc3377397c80a1e
|
{
"intermediate": 0.39077627658843994,
"beginner": 0.2769041359424591,
"expert": 0.3323195278644562
}
|
4,009
|
I have the following functions in react
const reload = async(index) => {
setNomenclaturaFull([]);
setSelectOption([]);
getHouses(nomenclaturas);
setSelectOption(nomenclaturaFull[index]);
console.log("reloaded");
};
const getHouses = (nomenclaturas) => {
let houses = nomenclaturas.data.map(async (item, index) => {
let data = { ...item };
let houses = await getNomenclaturasCasasHelper(
"Yd5MV7jkA0MjQeCmzKrZ",
nomenclaturas.data[index].id
).then((houseData) => {
data.houseData = houseData;
});
return data;
});
Promise.all(houses).then((data) => {
setNomenclaturaFull(data);
});
};
setSelectedOption is setting up the older version of the variable nomenclaturas, I want it to wait for getHouses to set the new version of nomenclaturas
|
7f3043acf2cbc9c500ee26a406d017c8
|
{
"intermediate": 0.2951614260673523,
"beginner": 0.5159214735031128,
"expert": 0.1889171302318573
}
|
4,010
|
hello
|
f9749071b4e933a36fd08687afe42938
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
4,011
|
act as a python expert programmer. I will ask questions about python scripts.
|
b391ae2492318e489b41995a3bec6803
|
{
"intermediate": 0.21787025034427643,
"beginner": 0.5740601420402527,
"expert": 0.20806962251663208
}
|
4,012
|
This sql server query selects all the groups that are connected to the tblSource based on SomeoneIDs from #tblSomeTable and sourcetype. How do I change it to also select the direct children of those groups?
SELECT groups.*
INTO #tblGroup
FROM tblGroup groups
JOIN tblSource source ON source.SourceID = groups.SourceID
JOIN tblSomeone someone ON someone.ClientId = source.SourceID
JOIN tblSourceType sourceType ON sourceType.SourceTypeID = source.SourceTypeID
WHERE (someone.SomeoneID IN (SELECT SomeoneID FROM #tblSomeTable)) AND (sourceType.Description = 'someone')
|
9a60101b1daa414a504fb26befae924d
|
{
"intermediate": 0.4634740650653839,
"beginner": 0.2631259858608246,
"expert": 0.2733999192714691
}
|
4,013
|
I have the following functions in react
const reload = async(index) => {
setNomenclaturaFull([]);
setSelectOption([]);
getHouses(nomenclaturas);
setSelectOption(nomenclaturaFull[index]);
console.log("reloaded");
};
const getHouses = (nomenclaturas) => {
let houses = nomenclaturas.data.map(async (item, index) => {
let data = { ...item };
let houses = await getNomenclaturasCasasHelper(
"Yd5MV7jkA0MjQeCmzKrZ",
nomenclaturas.data[index].id
).then((houseData) => {
data.houseData = houseData;
});
return data;
});
Promise.all(houses).then((data) => {
setNomenclaturaFull(data);
});
};
useEffect(() => {
if (selectOption) {
let profile = selectOption.houseData.map(async (item, index) => {
let data = { ...item };
if (data.idOwners) {
const profile = await getProfileByHouseIdHelper(
data.idOwners[0]
).then((pro) => {
data.userProfile = pro;
});
}
return data;
});
Promise.all(profile).then((data) => {
setSelectHouseDataFull(data);
});
}
}, [selectOption]);
setSelectedOption is setting up the older version of the variable nomenclaturas, I want it to wait for getHouses to set the new version of nomenclaturas
|
d29ec01e91db75656b494a0d106f76cd
|
{
"intermediate": 0.3312092125415802,
"beginner": 0.45419618487358093,
"expert": 0.2145945131778717
}
|
4,014
|
can you talk
|
df88243331993c4db52d2b151f806e9e
|
{
"intermediate": 0.4275440275669098,
"beginner": 0.16199131309986115,
"expert": 0.41046467423439026
}
|
4,015
|
<a class="buyprodbtn" data-prod-id="<?php echo $prodID; ?>">BUY</a>
|
2347de4a8d930f082cd96552ac44c638
|
{
"intermediate": 0.2570630609989166,
"beginner": 0.4850207567214966,
"expert": 0.2579161524772644
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.