instruction
stringlengths
0
30k
βŒ€
|assembly|x86|expression|division|
I will offer my own option for `docker run`. The problem of passing multi-line variables in a .env file was discussed here. https://github.com/moby/moby/issues/12997 . The developers suggest solving the problem using sh/bash How to solve the problem using sh 1. putting multi-line data into a file and import to variable MY_VAR.env ``` Text Text Text ``` `docker run -e MY_VAR="$(cat MY_VAR.env)"` 2. If you need to pass many variables from a file, then you will have to do a compound query Variables format in file `-e NAME_VARIABLE="Multi-line text" \` my.env ``` -e MY_VAR=" Text Text text " \ -e MY_VAR2="TEXT" \ -e MY_VAR3="TEXT TEXT TEXT" ``` `sh -c "docker run $(cat my.env)"`
this is my code: ``` import { Button, FlatList, NativeSyntheticEvent, Text, TextInput, TextInputFocusEventData, View, } from "react-native"; import { MissionStoreType } from "../../types/Missions.types"; import { globalStyles } from "../../styles/globals.styles"; import { useAppDispatch, useAppSelector } from "../../redux/app/hooks"; import { MissionSelector, addMission, convertToChild, editMissionTitle, focusedMissionSelector, openMissionChildren, removeMission, setFocusedMission, } from "../../redux/features/MissionsSlice"; import { Directions, Gesture, GestureDetector, } from "react-native-gesture-handler"; interface MissionProps { id: string; index: number; nestLevel: number; } const Mission: React.FC<MissionProps> = ({ id, nestLevel, index, }: MissionProps) => { const dispatch = useAppDispatch(); const mission: MissionStoreType = useAppSelector(MissionSelector(id)); const focusedMission = useAppSelector(focusedMissionSelector); const rightFling = Gesture.Fling() .enabled(index > 0) .direction(Directions.RIGHT) .onStart(() => { dispatch(convertToChild({ id, index })); // convertToChild is empty action! (didnt do anything...) }); const leftFling = Gesture.Fling() .enabled(nestLevel > 0) .direction(Directions.LEFT) .onStart(() => console.log("fling left")); const gestures = Gesture.Simultaneous(rightFling, leftFling); const handleTextInputBlur = () => { dispatch(setFocusedMission(null)); if (mission.text === "") dispatch(removeMission({ id, index })); }; return ( <GestureDetector gesture={gestures}> <View> <View style={globalStyles.rowContainer}> <View style={{ width: nestLevel * 20 }} /> <Button title="del" onPress={() => dispatch(removeMission({ id, index }))} /> <TextInput onFocus={() => dispatch(setFocusedMission(id))} onBlur={handleTextInputBlur} style={globalStyles.flex1} value={mission.text} onChangeText={(text) => dispatch(editMissionTitle({ id, text }))} onSubmitEditing={() => dispatch(addMission({ id, index }))} autoFocus={focusedMission === id} /> {mission.children.length > 0 && ( <Button title="open" onPress={() => dispatch(openMissionChildren(id))} /> )} </View> {mission.open && mission.children.length > 0 && ( <FlatList data={mission.children} keyExtractor={(item) => item} renderItem={({ item, index: childrenIndex }) => ( <Mission id={item} nestLevel={nestLevel + 1} index={childrenIndex} /> )} /> )} </View> </GestureDetector> ); }; export default Mission; ``` i use Expo to run my app. i try to do some store changes when i swipe to the right on a mission, but, my app totally crush.. what it can be? thanks! i try to use runOnJS and runOnUI functions from react native reanimated. at first i has some state changing but i remove all of them to see if there is the problem.
MbedTLS: Does mbedtls_rsa_rsaes_oaep_encrypt/decrypt support in-place en-/decryption? (It should, but it doesn't seem to work?)
|c|cryptography|embedded|rsa|mbedtls|
null
I don't know if you are using Application Insights to also log requests and telemetry in general, but that is definitely what we would check in our projects when we have scenarios like this. Eventually, you will be able to see exactly what are the requests causing a 404 and compare to your http trigger endpoint. Microsoft documentation on how to add Application Insights to .net projects to be deployed to AKS: https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core?tabs=netcorenew
Pojos are often used as Models/DTOs for inserting/updating data into a database. They need to by validated (with a Validator) to make sure they only contain the expected fields for the use-case: - insert (all fields must be validated and inserted) - update (only changed/modified fields must be validated and updated into the database) To make this possible, it would be helpful if the Java-Language already contains a mechanism to track 'modified' in pojos. A 'modified' for a field would be: - a setter for a field has been called. Is there a library that can help me solve this with as less boilerplate as possible? --- Here an example of how i solved it with boilerplate, by letting the Pojos extend a common class: ```java public abstract class AbstractDTO { private Map<String, Object> modifiedFields = new HashMap<>(); public AbstractDTO() { } @JsonIgnore @XmlTransient protected void setAt(String key, Object value) { this.modifiedFields.put(key, value); } @JsonIgnore @XmlTransient public void resetModifiedFields() { this.modifiedFields.clear(); } @JsonIgnore @XmlTransient public Map<String, Object> getModifiedFields() { return this.modifiedFields; } } ``` Impl: ```java public class Product extends AbstractDTO { private Long productId; public Long getProductId() { return this.productId; } public void setProductId(Long productId) { this.productId = productId; this.setAt("productId", productId); } ``` That way i can now check for modified-fields: ```java boolean isModified = pojo.getModifiedFields().containsKey(field.getName()); ```
Java Pojos - Modified Fields and Change Detection
|java|validation|dto|pojo|
I'm currently confused about windows and states. Suppose I have a program that counts user access data every minute and needs to do sum statistics in each window. Assume that at this time, I configure checkpoint for the fault tolerance of the program. The checkpoint configuration is to trigger every 30 seconds. Then when the time is 01:00, the program hangs. In theory, it can only be restored to the state data at 00:30, but there is no trigger window at 00:30. After calculation, we get the kafka offset data at 00:30 and the window data at 00:00. Is there any problem with my understanding? here is my program: [flink graph][1] build stream: //config is config.getDelayMaxDuration() = 60000 SingleOutputStreamOperator<BaseResult> wordCountSampleStream = subStream.assignTimestampsAndWatermarks( WatermarkStrategy.<MetricEvent>forBoundedOutOfOrderness(config.getDelayMaxDuration()) .withTimestampAssigner(new MetricEventTimestampAssigner()) .withIdleness(config.getWindowIdlenessTime()) ).setParallelism(CommonJobConfig.getParallelismOfSubJob("WORD_COUNT_SAMPLE_TEST")) .flatMap(new WordCountToResultFlatMapFunction(config)).setParallelism(CommonJobConfig.getParallelismOfSubJob("WORD_COUNT_SAMPLE_TEST")) .keyBy(new BaseResultKeySelector()) .window(TumblingEventTimeWindows.of(Time.milliseconds(config.getAggregateWindowMillisecond()))) .apply(new WordCountWindowFunction(config)).setParallelism(CommonJobConfig.getParallelismOfSubJob("WORD_COUNT_SAMPLE_TEST")); wordCountSampleStream.addSink(sink).setParallelism(CommonJobConfig.getParallelismOfSubJob("WORD_COUNT_SAMPLE_TEST")); window apply function: public class WordCountWindowFunction extends RichWindowFunction<BaseResult, BaseResult, String, TimeWindow> { private StreamingConfig config; private Logger logger = LoggerFactory.getLogger(WordCountWindowFunction.class); public WordCountWindowFunction(StreamingConfig config) { this.config = config; } @Override public void close() throws Exception { super.close(); } @Override public void apply(String s, TimeWindow window, Iterable<BaseResult> input, Collector<BaseResult> out) throws Exception { WordCountEventPortrait result = new WordCountEventPortrait(); long curWindowTimestamp = window.getStart() / config.getAggregateWindowMillisecond() * config.getAggregateWindowMillisecond(); result.setDatasource("word_count_test"); result.setTimeSlot(curWindowTimestamp); for (BaseResult sub : input) { logger.info("in window cur sub is {} ", sub); WordCountEventPortrait curInvoke = (WordCountEventPortrait) sub; result.setTotalCount(result.getTotalCount() + curInvoke.getTotalCount()); result.setWord(curInvoke.getWord()); } logger.info("out window result is {} ", result); out.collect(result); } } sink function: public class ClickHouseRichSinkFunction extends RichSinkFunction<BaseResult> implements CheckpointedFunction { private ConcurrentHashMap<String, SinkBatchInsertHelper<BaseResult>> tempResult = new ConcurrentHashMap<>(); private ClickHouseDataSource dataSource; private Logger logger = LoggerFactory.getLogger(ClickHouseRichSinkFunction.class); @Override public void snapshotState(FunctionSnapshotContext context) throws Exception { for (Map.Entry<String, SinkBatchInsertHelper<BaseResult>> helper : tempResult.entrySet()) { helper.getValue().insertAllTempData(); } } @Override public void initializeState(FunctionInitializationContext context) throws Exception { } @Override public void open(Configuration parameters) throws Exception { Properties properties = new Properties(); properties.setProperty("user", CommonJobConfig.CLICKHOUSE_USER); properties.setProperty("password", CommonJobConfig.CLICKHOUSE_PASSWORD); dataSource = new ClickHouseDataSource(CommonJobConfig.CLICKHOUSE_JDBC_URL, properties); } @Override public void close() { AtomicInteger totalCount = new AtomicInteger(); tempResult.values().forEach(it -> { totalCount.addAndGet(it.getTempList().size()); batchSaveBaseResult(it.getTempList()); it.getTempList().clear(); }); } @Override public void invoke(BaseResult value, Context context) { tempResult.compute(value.getDatasource(), (datasource, baseResults) -> { if (baseResults == null) { baseResults = new SinkBatchInsertHelper<>(CommonJobConfig.COMMON_BATCH_INSERT_COUNT, needToInsert -> batchSaveBaseResult(needToInsert), CommonJobConfig.BATCH_INSERT_INTERVAL_MS); } baseResults.tempInsertSingle(value); return baseResults; }); } private void batchSaveBaseResult(List<BaseResult> list) { if (list.isEmpty()) { return; } String sql = list.get(0).getPreparedSQL(); try { try (PreparedStatement ps = dataSource.getConnection().prepareStatement(sql)) { for (BaseResult curResult : list) { curResult.addParamsToPreparedStatement(ps); ps.addBatch(); } ps.executeBatch(); } } catch (SQLException error) { log.error("has exception during batch insert,datasource is {} ", list.get(0).getDatasource(), error); } } } batch insert helper: public class SinkBatchInsertHelper<T> { private List<T> waitToInsert; private ReentrantLock lock; private int bulkActions; private AtomicInteger tempActions; private Consumer<List<T>> consumer; private AtomicLong lastSendTimestamp; private long sendInterval; private Logger logger = LoggerFactory.getLogger(SinkBatchInsertHelper.class); public SinkBatchInsertHelper(int bulkActions, Consumer<List<T>> consumer, long sendInterval) { this.waitToInsert = new ArrayList<>(); this.lock = new ReentrantLock(); this.bulkActions = bulkActions; this.tempActions = new AtomicInteger(0); this.consumer = consumer; this.sendInterval = sendInterval; this.lastSendTimestamp = new AtomicLong(0); } public void tempInsertSingle(T data) { lock.lock(); try { waitToInsert.add(data); if (tempActions.incrementAndGet() >= bulkActions || ((System.currentTimeMillis() - lastSendTimestamp.get()) >= sendInterval)) { batchInsert(); } } finally { lastSendTimestamp.set(System.currentTimeMillis()); lock.unlock(); } } public long insertAllTempData() { lock.lock(); try { long result = tempActions.get(); if (tempActions.get() > 0) { batchInsert(); } return result; } finally { lock.unlock(); } } private void batchInsert() { for(T t: waitToInsert){ logger.info("batch insert data:{}", t); } consumer.accept(waitToInsert); waitToInsert.clear(); tempActions.set(0); } public int getTempActions() { return tempActions.get(); } public List<T> getTempList() { lock.lock(); try { return waitToInsert; } finally { lock.unlock(); } } } The resulting phenomenon is: Suppose I cancel the task at 00:31:30, then when I restart the task, the statistics at 00:31:00 will be less than expected. I found out by printing records that it was because when the sink wrote the data at 00:30:00, the kafka consumer had actually consumed the data after 00:31:00, but this part of the data was not written to ck. , it was not replayed in the window when restarting, so this part of the data was lost. The statistics will not return to normal until 00:32:00. [1]: https://i.stack.imgur.com/03630.png
Try this option without window functions. ``` SELECT *, ( SELECT score FROM scores sp WHERE sp.id < s.id AND sp.score <> 30 ORDER BY sp.id desc LIMIT 1 ) _prev_element FROM scores s ``` [fiddle](https://dbfiddle.uk/iESmWbju)
e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (306, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (307, 16): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (464, 22): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (467, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (476, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (483, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (486, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (490, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (491, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (492, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (494, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (495, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (498, 63): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: public operator fun String?.plus(other: Any?): String defined in kotlin e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (500, 32): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (502, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (503, 17): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (506, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (507, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (509, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (514, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (516, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (650, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (850, 13): Unresolved reference: run e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (851, 24): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (858, 13): Unresolved reference: run e: /Users/subashkhatri/.pub-cache/hosted/pub.dev/speech_to_text-6.6.1/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt: (859, 24): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/subashkhatri/.gradle/caches/transforms-3/0be4579c3b0d57b8d268f0bc967fbf72/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':speech_to_text:compileDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more details * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 4s β”Œβ”€ Flutter Fix ──────────────────────────────────────────────────────────────────────────────┐ β”‚ [!] Your project requires a newer version of the Kotlin Gradle plugin. β”‚ β”‚ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then β”‚ β”‚ update /Users/subashkhatri/Development/sathi/android/build.gradle: β”‚ β”‚ ext.kotlin_version = '<latest-version>' β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Error: Gradle task assembleDebug failed with exit code 1 NOTE: I already update Kotline version to latest but still it show error Please Help ... I already upgrade Kotline version.
How to avoid being struct column name written to a json file? While writing the df to the json file? Using databricks pyspark write method. ```Df.write.option("header", "false").mode("overwrite).json(path)``` Tried option("header", "false") Sample json file: ```{"struct_col_name":{"actual_struct_data_col":"values"....}}``` Need to avoid first root key column struct_col_name. Sample dataframe/ schema [Sample dataframe picture][1] [PrintSchema picture][2] [1]: https://i.stack.imgur.com/HIW1Y.jpg [2]: https://i.stack.imgur.com/74Mu2.jpg
Symfony/Messenger no retry when critical exception from a web service
|php|symfony|symfony-messenger|
I would like to move the labels from the center to the beginning of each wedge in my pie chart: import matplotlib.pyplot as plt # Setting labels for items in Chart Employee = ['A', 'B', 'C', 'D', 'E'] # Setting size in Chart based on # given values Salary = [40000, 50000, 70000, 54000, 44000] # colors colors = ['#FF0000', '#0000FF', '#FFFF00', '#ADFF2F', '#FFA500'] fig, ax = plt.subplots(figsize=(5,5), facecolor = "#FFFFFF") # Pie Chart wedges, texts = ax.pie(Salary, colors=colors, labels=Employee, labeldistance=0.8, wedgeprops=dict(width=0.35),) I am able to get the coordinates of the labels and replace them with: for lbl,p in zip(Employee,texts, ): x, y = p.get_position() print(x,y,p) ax.annotate(lbl, xy=(x,y), size=12, color = "w") but I am not sure how to move them to follow the circle. I can also get the angles of the start of each wedge calling the wedges property, but as the pie chart is drawn on a cartesian axis rather that a polar one, I am not sure how to that either? I can not use barh for this (my chart is more complicated than the one shown here). Is this possible? The image shows the code with the original labels and the ones I can add using ax.annotate: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/keTTf.png
Move labels to the beginning of the wedge in matplotlib pie chart
|python|matplotlib|
After installing pygraphviz via conda, and trying to create graph: # graph: nx.DiGraph pos = nx.nx_agraph.graphviz_layout(graph, prog='dot', ...) # pos[node] ... positions are calculated normally, but the next warning is shown: > agraph.py:1405: RuntimeWarning: Warning: Could not load "*\Library\bin\gvplugin_pango.dll" > It was found, so perhaps one of its dependents was not. Try ldd. Downgrade or upgrade graphwiz and pygraphwiz in Conda was not flexible, install via pip fails due to missing header 'graphviz/cgraph.h' (MSVS build). Versions: Python 3.8 conda pygraphviz: 1.9 conda graphviz: 3.0.0 Also noticed that but by the [docs][1] it appears to be that `nx_agraph.graphviz_layout` is close to `nx.nx_pydot.pydot_layout`, which does not cause a warning. But a command line test of pydot command shows that the warning is still there, just not propagated into debug output. What would be the proper way to fix the warning? [1]: https://networkx.org/documentation/stable/reference/drawing.html
when XCode Cloud is building my app, this error appear: /Downloads/friendship.json: No such file or directory My my Copy Bundle Resources the file is located in downloads, I put it in a group in Xcode. Is there a way to remove the downloads section and put it in Xcode directly? The build is working fine when I remove the Copy Bundle Resources.
Xcode Cloud Error: No such file or directory
|xcode|xcode-cloud|
Tests shows that Python's `math.gcd` is one order faster than naive Euclidean algorithm implementation: ``` import math from timeit import default_timer as timer def gcd(a,b): while b != 0: a, b = b, a % b return a def main(): a = 28871271685163 b = 17461204521323 start = timer() print(gcd(a, b)) end = timer() print(end - start) start = timer() print(math.gcd(a, b)) end = timer() print(end - start) ``` gives ``` $ python3 test.py 1 4.816000000573695e-05 1 8.346003596670926e-06 ``` `e-05` vs `e-06`. I guess there is some optimizations or some other algorithm?
What is the algorithm behind math.gcd and why it is faster Euclidean algorithm?
|python-3.x|algorithm|math|euclidean-algorithm|
Finally, I've found a solution to this problem without utilizing the redirect and refreshListenable properties of GoRouter. The concept involves creating a custom redirection component. Essentially, authStateChanges are globbally listened, and upon any change in AuthenticationState, we navigate to our redirection component. In my implementation, this redirection component is a splash page. From there, you can proceed to redirect to the desired page. Here is my code Router Class class AppRouter { factory AppRouter() => _instance; AppRouter._(); static final AppRouter _instance = AppRouter._(); final _config = GoRouter( initialLocation: RoutePaths.splashPath, routes: <RouteBase>[ GoRoute( path: RoutePaths.splashPath, builder: (context, state) => const SplashPage(), ), GoRoute( path: RoutePaths.loginPath, builder: (context, state) => const LoginPage(), ), GoRoute( path: RoutePaths.registrationPath, builder: (context, state) => const RegistrationPage(), ), GoRoute( path: RoutePaths.homePath, builder: (context, state) => const HomePage(), ), ], ); GoRouter get config => _config; } class RoutePaths { static const String loginPath = '/login'; static const String registrationPath = '/register'; static const String homePath = '/home'; static const String splashPath = '/'; } Authentication Bloc AuthenticationBloc( this.registerUseCase, this.loginUseCase, ) : super(const AuthenticationInitial()) { on<AuthenticationStatusCheck>((event, emit) async { await emit.onEach( FirebaseAuth.instance.authStateChanges(), onData: (user) async { this.user = user; emit(const AuthenticationSplash()); await Future.delayed(const Duration(seconds: 1, milliseconds: 500), () { if (user == null) { emit(const AuthenticationInitial()); } else if (state is! AuthenticationSuccess) { emit(AuthenticationSuccess(user)); } }); }, ); }); Main final router = AppRouter().config; return MultiBlocProvider( providers: [ BlocProvider<AuthenticationBloc>( create: (context) => sl<AuthenticationBloc>()..add(const AuthenticationStatusCheck()), ), ], child: BlocListener<AuthenticationBloc, AuthenticationState>( listener: (context, state) { if (state is AuthenticationSplash) { router.go(RoutePaths.splashPath); } }, child: MaterialApp.router( title: 'Hero Games Case Study', theme: ThemeData.dark( useMaterial3: true, ), routerConfig: router, ), ), ); splash_page return BlocListener<AuthenticationBloc, AuthenticationState>( listener: (context, state) { if (state is AuthenticationSuccess) { context.go( Uri.base.path == RoutePaths.splashPath ? RoutePaths.homePath : Uri.base.path, ); } else if (state is AuthenticationInitial) { context.go(RoutePaths.loginPath); } }, child: Scaffold( appBar: AppBar( title: const Text('Splash Page'), ), body: const Center( child: CircularProgressIndicator(), ), ), ); NOTE: If you will use deeplinking, you can add the code below to your GoRouter redirect: (context, state) { if (context.read<AuthenticationBloc>().user == null && (state.fullPath != RoutePaths.loginPath && state.fullPath != RoutePaths.registrationPath && state.fullPath != RoutePaths.splashPath)) { return RoutePaths.splashPath; } return null; },
{"Voters":[{"Id":4850040,"DisplayName":"Toby Speight"},{"Id":874188,"DisplayName":"tripleee"},{"Id":839601,"DisplayName":"gnat"}],"SiteSpecificCloseReasonIds":[18]}
null
{"Voters":[{"Id":23528,"DisplayName":"Daniel A. White"},{"Id":8565438,"DisplayName":"zabop"},{"Id":839601,"DisplayName":"gnat"}],"SiteSpecificCloseReasonIds":[13]}
class Solution { public String minWindow(String s, String t) { int n = s.length(); int m = t.length(); HashMap<Character, Integer> map = new HashMap<>(); int count = 0; int start = -1; int min = Integer.MAX_VALUE; int l = 0; int r = 0; for (int i = 0; i < m; i++) map.put(t.charAt(i), map.getOrDefault(t.charAt(i), 0) + 1); while (r < n) { if (map.getOrDefault(s.charAt(r), 0) > 0) count++; map.put(s.charAt(r), map.getOrDefault(s.charAt(r), 0) - 1); while (count == m) { if (r - l + 1 < min) { min = r - l + 1; start = l; } map.put(s.charAt(l), map.get(s.charAt(l)) + 1); if (map.get(s.charAt(l)) > 0) count--; l++; } r++; } if (start == -1) return ""; return s.substring(start, start + min); } }
I try to read the file with specific extension .compressed. I created it using Fano encoding: ```c++ std::ofstream out; out.open(file_name + ".compressed", std::ios::out | std::ios::binary); in.open(file_name, std::ios::in | std::ios::binary); in >> std::noskipws; if (!out) { out.close(); in.close(); return false; } wchar_t sym; char buffer = 0; int bit = 1; while(in >> sym) { for (wchar_t b : fano_codes[sym]) { if (b == '1') buffer |= 0b00000001; if (bit == CHAR_BIT) { out << buffer; buffer = 0; bit = 1; } else { buffer <<= 1; bit++; } } } if (bit != 0) { for (; bit <= CHAR_BIT; bit++) { buffer <<= 1; } out << buffer; } out.close(); in.close(); ``` So when I try to read this file it doesn't work. ```c++ std::wifstream in; in.imbue( std::locale(std::locale(), new std::codecvt_utf8<wchar_t>) ); in >> std::noskipws; in.open(file_name, std::ios::binary | std::ios::in); if (!in) { in.close(); return false; } wchar_t sym; std::wstring file_code; while (in >> sym) { // this 'while' always is skipped file_code += sym; } in.close(); ``` I used many `modes` (such as `std::ios::binary`) in `open()` function, checked all flags in stream and tried to use `get()` instead of `>>`, nothing worked and I don't know why.
run RTK dispatch on gesture start with React Native
|react-native|redux-toolkit|gesture|
null
{"OriginalQuestionIds":[72790215],"Voters":[{"Id":2144390,"DisplayName":"Gord Thompson","BindingReason":{"GoldTagBadge":"python"}}]}
I'm struggling with sessions and need some help. The following is my processing.php file which starts the session and assigns session variables for a user. If the user is a participant, then they are assigned usertype='Participant' and upon login, they are redirected to a different webpage: participant.php. ``` <?php session_start(); ?> <?php include("connect.php"); $email=$_POST['un']; $password=$_POST['pw']; $loginsql="SELECT * from Users WHERE email = '$email' AND password = '$password'"; $result = $smeConn->query($loginsql); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $_SESSION['id'] = $row['id']; $_SESSION['email'] = $row['email']; $_SESSION['first'] = $row['first']; $userID = $row['id']; $participantSql = "SELECT * FROM Participants WHERE user = $userID"; $participantResult = $smeConn->query($participantSql); if ($participantResult->num_rows > 0) { $_SESSION['usertype'] = 'Participant'; } else { $_SESSION['usertype'] = $row['usertype']; } echo "success"; } else { echo "error"; } ?> ``` The problems come up in these lines of code on my navigate.php: ``` <?php if(isset($_SESSION['usertype']) && $_SESSION['usertype']=="Participant"){ echo "<script>location.href='https://beroz.pwcswebdev.com/SMU_Part5/signMeUp04_v5-1-3/participant.php';</script>"; } ?> ``` When I login as a user who is a participant, I am redirected ONLY AFTER refreshing the webpage. After being redirected to participant.php, the page just starts rapidly refreshing over and over again. I am only able to see SOME of the navbar content, and there is no "Welcome, user" or log out button (which works on index.php). In addition to this, nothing I do gets me back to index.php, even if I refresh or close the webpage. The only way to fix this and go back to index.php is by commenting out the echo <script>. If you want to test it, the webpage is live at this link: https://beroz.pwcswebdev.com/SMU_Part5/signMeUp04_v5-1-3/index.php For the login, email: fluffy@amelie.co.fr password: 8roadw4Y
window.location.href redirects but is causing problems on the webpage
|php|jquery|mysql|ajax|phpmyadmin|
You could use the `request()->is('route-name*')` method. This will also work for all sub-routes of your route. 'blog/view/{id}' 'blog/edit/{id}' <li class="nav-item {{ request()->is('blog*') ? 'active' : ''}}"> <a class="nav-link " href="{{ url('blog') }}">{{ __('sentence.Blog') }} </a> </li>
{"Voters":[{"Id":573032,"DisplayName":"Roman C"},{"Id":3795036,"DisplayName":"K.Nicholas"},{"Id":522444,"DisplayName":"Hovercraft Full Of Eels"}]}
No programming is required. Create a shortcut to your program on the desktop. Right-click it, Properties, Layout tab. Adjust the Width property of the screen buffer and window size. But you can do it programmatically too, those Windows API functions you found are wrapped by the Console class as well. You first have to make sure that the console buffer is large enough, then you can set the window size to a size that's less or equal to the buffer size. For example: static void Main(string[] args) { if (!Console.IsOutputRedirected) { Console.BufferWidth = 100; Console.SetWindowSize(Console.BufferWidth, 25); } Console.ReadLine(); }
To answer your original question: Importing a docker image worked for me. And because it took me a while to gather the necessary steps, I'll list them here. As a note, I ran the docker commands from within another Linux distro in WSL, simply because I found it easier to handle there than on Windows. I don't believe this changes anything, though. I looked for Debian images [here](https://hub.docker.com/_/debian/tags?page=1&name=bullse), and decided on bullseye-slim: `docker pull debian:bullseye-slim` Once `docker run debian:bullseye-slim` gets this image running its container ID can be found from a different terminal via `docker container ls` or `docker ps` (or, if you are scripting this step, via the command provided in the [Microsoft docu](https://learn.microsoft.com/en-us/windows/wsl/use-custom-distro#export-the-tar-from-a-container)). `docker export CURRENT_ID > debian11.tar` created a .tar file from the still running image. Now calling `wsl --import Debian11 .\WSLStorage\Debian11\ .\debian11.tar` from the Windows Powershell successfully imported it to the pre-existing folder `.\WSLStorage\Debian11\`.
Disabling Flash 3.x logging messages
Hi everyone i just enccounter a weird reactJS error while building my project alert error message prom after adding "child_process": false into falback of webpack.config.js to fix the error child_process undefined: [enter image description here](https://i.stack.imgur.com/kLNAi.png) and another error [enter image description here](https://i.stack.imgur.com/mWkRt.png) locate in index.js in node_modules > nodemon > lib > utils > index.js and in webpack folder It seem to occur at line with the context of using split for undefined value i think ``` var noop = function () { }; var path = require('path'); const semver = require('semver'); var version = process.versions.node.split('.') || [null, null, null]; ``` At first i try to debug by simply delete process.versions.node.split('.') result into change: ``` var version = [null, null, null]; var version = [0, 0, 0]; ``` 2 post having the similar error that i follow is [post 1](https://stackoverflow.com/questions/61320950/typeerror-cannot-read-property-split-of-undefined-in-nodejs-nodemon) [post 2](https://stackoverflow.com/questions/42217146/browserify-builds-stopped-all-return-error-on-process-versions-node) I try according to [issue #120](https://github.com/browserify/resolve/commit/6739500f9632fbf5ce2e937ed85266ea2805fdbf) ``` var version = process.version.node.split('.') || [null, null, null]; //post 1 var current = process.versions && process.versions.node && process.versions.node.split('.') || []; //post 2 ``` i noticed that the browser (Chrome) still alert error in it system as ``` var version = process.versions.node.split('.') || [null, null, null]; ``` After that i ask copilot and GPT, they said that my application was being poorly configure lead to let my webpack.config.js modified my nodemone (i use CRA to create project) and should include ``` externals: { nodemon: 'nodemon' }, ``` in module.exports in webpack.config.js to tell webpack to not modify the nodemon but nothing change. but again nothing much change. I didn't try npm install resolve because i believe that my problem didn't come from resolve because i did debug webpack breaking change error "Undefinded fs" by adding fallback fs: false but i will try if you guys think other wise
null
I'm having an issue updating empty cells in an Excel spreadsheet using the Microsoft Access 2016 OLE DB driver, which I invoke from MSADO/C++. Updating the field causes a "Type Mismatch" exception. My understanding of the issue was that the Access OLE DB driver determines the datatype of a column by scanning a number of rows as per the ``TypeGuessRows`` setting in the registry at ``Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Access Connectivity Engine\Engines\Excel`` I've tried different values for this setting, and none made a difference. It seems the driver is scanning all the column's cells, and typing them as ``VT_NULL``, rather than ``VT_BSTR``. If the column is already populated with values, the problem goes away. The spreadsheet, which is very simple, looks like this: [![enter image description here][1]][1] What I'm trying to do is update the "Target" column with translations of the cells in "Source". I create an ADO Recordset as follows: ``` CString m_szSQLStatement = L"SELECT [Sheet1$].[ID], [Sheet1$].[Source], [Sheet1$].[Target] FROM [Sheet1$]"; m_pRecordSet->CursorLocation = adUseServer; m_pRecordSet->Open((_bstr_t) m_szSQLStatement.GetBuffer(0),_bstr_t( m_szConnectionStr.GetBuffer(0) ),adOpenKeyset,adLockOptimistic, adCmdText); _bstr_t bstrFieldName = _bstr_t(L"Target"); FieldPtr pField = m_pRecordSet->Fields->GetItem(bstrFieldName); pField->Value = "new value" ``` I've tried a few different things to workaround this issue: - Calling ``pField->Value.ChangeType(VT_BSTR)`` - Initializing the column value with an empty ``_bstr_t`` like this: ``pFields->GetItem(bstrFieldName)->Value = (_bstr_t)L""`` - Explicitly casting the column to a string within my SQL query using the ``CStr()`` function provided by MS-Access. - Modifying the schema of the document before retrieving data from it using ``ALTER TABLE ALTER COLUMN "Target" VARCHAR(65535)`` - this returned an error saying "operation not supported" - Adding ``IMEX=1`` to my connection string's ``Extended Properties`` field - this rendered the spreadsheet read only - Setting ``TypeGuessRows`` to 0 in the registry as mentioned previously. None of the above worked, and I'm now out of ideas. I'm not sure if it's even possible to do what I want with my spreadsheet, but was hoping someone with more knowledge could point me in the right direction. Thanks [1]: https://i.stack.imgur.com/IdCfX.png
Excel column datatype issues using MSADO and Access 2016 Engine driver
|excel|ms-access|visual-c++|ado|
My `useGetProductsQuery` is not being recognized for some reason. productsApiSlice.js import { PRODUCTS_URL } from "../constants"; import { apiSlice } from "./apiSlice"; export const productsApiSlice = apiSlice.injectEndpoints({ endpoints: (builder) => ({ getProducts: builder.query({ query: () => ({ url: PRODUCTS_URL, }), keepUnusedDataFor: 5, }), }), }); export const { useGetProductsQuery } = productsApiSlice; component: import { useGetProductsQuery } from "../slices/productsApiSlice"; function HomeScreen() { const { data: products, isLoading, error } = useGetProductsQuery(); return ( <div className="row"> {isLoading ? ( <h2>Loading...</h2> ) : error ? ( <div>{error?.data?.message || error.error}</div> ) : ( <p>test</p> )} </div> ); }
Can't read the file using std::wifstream C++
|c++|file|std|wifstream|
null
|python|list|distribute|
null
Is there a way to distribute more similarly than the method below? I'm also curious about how to distribute it from more than one list. The list can contain only five numbers. ``` intList = [] for i in range(10): intList.append(random.randint(10,200)) listX = [] listY = [] intList.sort(reverse=True) for i in range(len(intList)): if sum(listX) >= sum(listY): if len(listY) != 5: listY.append(intList[i]) else: listX.append(intList[i]) else: if len(listX) != 5: listX.append(intList[i]) else: listY.append(intList[i]) print(f"listx = {listX} \nlisty = {listY}\n sum x = {sum(listX)}, y = {sum(listY)}") ```
How to distribute the sum of several numbers similarly?
{"Voters":[{"Id":4369919,"DisplayName":"N69S"},{"Id":11854986,"DisplayName":"Ken Lee"},{"Id":839601,"DisplayName":"gnat"}]}
--Remove Duplciates[SKR] --Option A: select * --delete t from( select rowNumber=row_number() over (partition by SomeKey order by SomeKey), SomeKey from YourTable m )t where rowNumber > 1 --Option B: with cte as ( select rowNumber=row_number() over (partition by SomeKey order by SomeKey), SomeKey from YourTable m ) --delete from cte where rowNumber > 1 select * from cte where rowNumber > 1
how to use custom function ? I use both the standard search function and the custom one, but as a result I get an empty array custom function in composable ``` // composable/custom-search-content.ts export default async function customSearchContent(search: Ref<string>) { const runtimeConfig = useRuntimeConfig() const { integrity, api } = runtimeConfig.public.content const { data } = await useFetch(`${api.baseURL}/search${integrity ? '.' + integrity : ''}.json`) const { results } = useFuse(search, data) return results } ``` file nuxt.config ``` // nuxt.config.ts export default defineNuxtConfig({ modules: ['@nuxt/content'], content: { documentDriven: true, experimental: { search: true }, watch: false } }) ``` file .json ``` // content/search.json { "title": "Hello Content v2!", "textFirst": "first", "hello": "hello" } ``` file component ``` // component.vue <script setup lang="ts"> const result = await searchContent('hello'); const result2 = await customSearchContent('hello'); </script> <template> <main> <pre>{{ result }} </pre> <pre>{{ result2 }} </pre> </main> </template> ``` result ``` [] [] ``` result empty array
There are 8 Linux namespaces which isolates PIDs, Network, Users, etc. https://man7.org/linux/man-pages/man7/namespaces.7.html It allows a namespaced process to have independent PIDs, network devices, users, etc. They are kernel resources but only visible within one specific namespace. They are guaranteed to not affect other namespaces. However I heard that BPF code is not. Once injected in one namespace it has access to everything. Is there a need for BPF namespace?
``` function sendDataToServer( firstName, lastName, phoneNumber, address, birthday, age, idNumber, gender, degree, intake, semester, course ) { console.log("sending date" + birthday); console.log("sending nic" + idNumber); console.log("sending phone" + phoneNumber); console.log(typeof phoneNumber); console.log(typeof idNumber); console.log(typeof birthday); fetch("http://localhost:8080/student/add", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, address: address, birthday: birthday, age: age, idNumber: idNumber, gender: gender, degree: degree, intake: intake, semester: semester, course: course, }), }) .then((response) => { if (response.ok) { alert("Student added successfully"); } else { alert("An error occurred"); console.log(response); } }) .catch((error) => { console.log(error); alert("An error occurred"); }); } ``` This function takes in various parameters representing user data such as firstName, lastName, phoneNumber, address, birthday, age, idNumber, gender, degree, intake, semester, and course. These are all String data and in database also these are all defined as Strings I take the date, nic and phoneNumber as Strings and tried to pass it, but JSON body does not passing these three Strings but it passing other strings. Why is that ??
The problem was effectively the libbox2d.a, I built box2d on windows and my code compiled well with the new libbox2d.a.
I have the following reusable react component: "use client"; import { useState } from "react"; import { ColumnDef, flexRender, ColumnFiltersState, getFilteredRowModel, getCoreRowModel, getPaginationRowModel, useReactTable, } from "@tanstack/react-table"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; function DataTable({ columns, data, searchColumn, }) { const [columnFilters, setColumnFilters] = useState([]) const table = useReactTable({ data, columns, onColumnFiltersChange: setColumnFilters, getFilteredRowModel: getFilteredRowModel(), getCoreRowModel: getCoreRowModel(), getPaginationRowModel: getPaginationRowModel(), state: { columnFilters: columnFilters, } }); return ( <> <div className="flex items-center py-4"> <Input placeholder="Search..." value={(table.getColumn(searchColumn)?.getFilterValue()) ?? ""} onChange={(event) => table.getColumn(searchColumn)?.setFilterValue(event.target.value) } className="max-w-sm" /> </div> <div className="border rounded-md"> <Table> <TableHeader> {table.getHeaderGroups().map((headerGroup) => ( <TableRow key={headerGroup.id}> {headerGroup.headers.map((header) => { return ( <TableHead key={header.id}> {header.isPlaceholder ? null : flexRender( header.column.columnDef.header, header.getContext() )} </TableHead> ); })} </TableRow> ))} </TableHeader> <TableBody> {table.getRowModel().rows?.length ? ( table.getRowModel().rows.map((row) => ( <TableRow key={row.id} data-state={row.getIsSelected() && "selected"} > {row.getVisibleCells().map((cell) => ( <TableCell key={cell.id}> {flexRender(cell.column.columnDef.cell, cell.getContext())} </TableCell> ))} </TableRow> )) ) : ( <TableRow> <TableCell colSpan={columns.length} className="h-24 text-center"> No results. </TableCell> </TableRow> )} </TableBody> </Table> </div> <div className="flex items-center justify-end py-4 space-x-2"> <Button variant="outline" size="sm" onClick={() => table.previousPage()} disabled={!table.getCanPreviousPage()} > Previous </Button> <Button variant="outline" size="sm" onClick={() => table.nextPage()} disabled={!table.getCanNextPage()} > Next </Button> </div> </> ); } export default DataTable; And my main component is: "use client"; import React, { useEffect, useState } from "react"; import DataTable from "@/components/ui/data-table"; import { columns } from "./columns"; function Customers() { const [data, setData] = useState([]); useEffect(() => { getAllDishes(); }, []); async function getAllDishes() { const response = await fetch("/api/getalldishes"); const data = await response.json(); const usersData = data.data; setData(usersData); } return ( <> <div className="container my-5"> <h1 className="mb-4 text-2xl font-semibold">Dishes</h1> <DataTable columns={columns} data={data} searchColumn={"name"} /> </div> </> ); } export default Customers; As you can see i am fetching data here and passing to the reusable component along with columns. My `columns.js`: "use client"; import Image from "next/image"; import { Switch } from "@/components/ui/switch"; async function handleCheckChange(id, updatedValue) { try { const response = await fetch("/api/admin/updateavailability", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ id, updatedValue, }), }); const data = await response.json(); if (!data.success) { throw data.message; } window.location.reload(); } catch (err) { console.log(err); } } export const columns = [ { accessorKey: "isVeg", header: "", cell: ({ row }) => ( <div className="flex justify-center"> {row.getValue("isVeg") ? ( <Image src="https://img.icons8.com/color/480/vegetarian-food-symbol.png" style={{ width: "15px", height: "15px" }} className="inline-flex me-3" width={15} height={15} alt="" /> ) : ( <Image src="/non-veg.png" style={{ width: "15px", height: "15px" }} className="inline-flex me-3" width={15} height={15} alt="" /> )} </div> ), }, { accessorKey: "name", header: "Name", }, { accessorKey: "description", header: "Description", cell: ({ row }) => ( <div className="w-[150px] truncate"> <span>{row.getValue("description")}</span> </div> ), }, { accessorKey: "course", header: "Course", }, { accessorKey: "cuisine", header: "Cuisine", }, { accessorKey: "calories", header: "Calories", cell: ({ row }) => <span>{row.getValue("calories")} Kcal</span>, }, { accessorKey: "price", header: "Price", cell: ({ row }) => <span>β‚Ή{row.getValue("price").toFixed(2)}</span>, }, { accessorKey: "available", header: "Available", cell: ({ row }) => { return ( <div className="flex justify-center"> <Switch checked={row.getValue("available")} onClick={() => handleCheckChange(row.original._id, !row.original.available) } /> </div> ); }, }, ]; I have a column called available, where i am rendering a switch and on toggling that, i am updating the db. I want to be able to refetch the new data when this happens. But the data is in my main component. How do i achieve this?
Calling functions from Main Component while using tanstack table
|javascript|next.js|tanstack-table|
I have a class, Word, that has a String representing a word and an Enum representing the difficulty of the word. Then I have another class, Vocab, that has an ArrayList of Word-objects. I want to sort my ArrayList by either difficulty or by the alphabetical order of the word. I figured I should use a Comparator, and here is how I did it. All classes are in the same package: Diff: public enum Diff { EASY, MEDIUM, HARD; } Word: public class Word { private String word; private Diff diff; public Word(String word, Diff diff) { this.word = word; this.diff = diff; } public String getWord() { return word; } public void setWord(String word) { this.word = word; } public Diff getDiff() { return diff; } public void setDiff(Diff diff) { this.diff = diff; } @Override public String toString() { String string = getWord() + ", " + getDiff(); return string; } } Vocab: public class Vocab { private ArrayList<Word> words; public Vocab() { words = new ArrayList<>(); } public void sortByPrio() { Collections.sort(words, prioCompare); } public void sortByName() { Collections.sort(words, nameCompare); } private Comparator<Word> prioCompare = new Comparator<Word>() { @Override public int compare(Word w1, Word w2) { return (w1.getDiff().ordinal() - w2.getDiff().ordinal()); } }; private Comparator<Word> nameCompare = new Comparator<Word>() { @Override public int compare(Word w1, Word w2) { return (w1.getWord().compareToIgnoreCase(w2.getWord())); } }; public void addWord(Word newWord) { words.add(newWord); } @Override public String toString() { String string = words.toString(); return string; } } Main: public class Main { public static void main(String[] args) { Vocab myWords = new Vocab(); myWords.addWord(new Word("Apple", Diff.EASY)); myWords.addWord(new Word("Besmirch", Diff.MEDIUM)); myWords.addWord(new Word("Pulchritudinous", Diff.HARD)); myWords.addWord(new Word("Dog", Diff.EASY)); System.out.println(myWords); myWords.sortByPrio(); System.out.println(myWords); } } Is anything inherently wrong with my code above, regarding my implementation of the Comparator? If so, what should I improve? Also, I haven't redefined `equals`, which I usually do when I implement `Comparable`. Should I redefine it now as well?
_slices_productsApiSlice__WEBPACK_IMPORTED_MODULE_1__.useGetProductsQuery) is not a function
|rtk-query|
I need to show posts from a certain Instagram account in my app. Since dev API(https://developers.facebook.com/docs/instagram) requires users to log in, am I allowed to directly use graphql API like this https://www.instagram.com/graphql/query/?doc_id=17991233890457762&variables={"id":"173560420","first":12} ?
Instagram API: Fetching user posts
|app-store|instagram|instagram-api|
null
DuckDB has upsert support, see the docs: <https://duckdb.org/docs/sql/statements/insert#on-conflict-clause>
{"OriginalQuestionIds":[14596599],"Voters":[{"Id":721855,"DisplayName":"aled"},{"Id":139985,"DisplayName":"Stephen C","BindingReason":{"GoldTagBadge":"java"}}]}
I'm currently trying to setup an AWS Cognito User Pool. I have already verified my domain through SES but I can't enter an e-mail address from my verified domain. Only specific verified email addresses are allowed to select from the dropdown. Can someone explain how I can change this?
AWS Cognito SES FROM E-mail address only verified e-mail address allowed no verified domains
|amazon-web-services|amazon-cognito|amazon-ses|
For the issue of mapping `<C-S-m>` in windows terminal with Nvim, you need to bind `<C-S-m>` by using the `sendInput` command in Windows Terminal's `settings.json`. It will send a specific escape sequence when `<C-S-m>` is pressed. I prefer you to see this github [issue](https://github.com/microsoft/terminal/issues/406). you can add these lines in your windows terminal's `settings.json` ```json { "command": { "action": "sendInput", "input": "\u001b[EscapeSequence]" }, "keys": "ctrl+shift+m" } ``` You need to replace `"\u001b[EscapeSequence]"` with the actual escape sequence that Nvim expects for inserting `|>`. You may need to experiment with different sequences. I can't check it since I'm not using windows
I have a bunch of German texts, but lost all whitespaces. Now I need to perform some kind of word boundary detection to get from "NamensΓ€nderungimNamenderIntegration" to ["NamensΓ€nderung", "im", "Namen", "der", "Integration"]. I found the python package wordsegment and it works okay, but not ideally. I also found the german_compound_splitter, but that would also split "NamensΓ€nderung" in "Namens" "Γ€nderung". Does anyone have any experience with that or knows how I could build a solution?
Automatic Word Boundary Detection for German
|python|nlp|linguistics|word-boundary|
null
We can use `csv.reader` to load the data in order. Let's say we this data in a csv file: ``` import csv, io raw_data = '''File name,Date,Time,ID,Type report.csv,27.03.2024,11:15,12345,Thing No.,Device,Version,Readout date,Readout time,Value 1,Value 2,Value 3 1,2345678,10,26.03.2024,10:00,463,470,482 2,3456789,11,26.03.2024,11:00,298,340,363 3,4567890,12,26.03.2024,12:00,587,600,621 ''' data = csv.reader(io.StringIO(raw_data)) ``` We create the first dictionary directly by reading the first 2 lines: first_table = dict(zip(next(data), next(data))) To get the next one, we can use `pandas.DataFrame`, but before we have to skip empty lines: ``` import pandas as pd for line in data: if line: break df = pd.DataFrame(data, columns=line) ```
Undefined split in index.js and throw error in webpack bootstrap
|javascript|reactjs|node.js|webpack|
null
> My expectation would be that creating the instance `Base` with the specified type `str` it is used for `V` which should be compatible in the `test()` return value as it converts to `Test[str](t)` Your `b = Base[str]()` line has no retroactive effect on the definition of `class Base(Generic[V]):` whatsoever - the definition of `Base.test` simply fails the type check because `t` is `str` (via `t = '1'`), and so what's being returned is `Test[str]` and not a generic `Test[V]` - it's not a way to return "mix" types (see the [`typing.AnyStr`](https://docs.python.org/3/library/typing.html#typing.AnyStr) as an example and the documentation there has a discussion on this). Changing that assignment to `t = 1` and to `b = Base[int]()`, mypy will complain about the opposite: ```lang-text error: Argument 1 to "Test" has incompatible type "int"; expected "str" [arg-type] ``` Using `pyright` actually gives a somewhat better error message: ```lang-text /tmp/so_78174062.py:16:24 - error: Argument of type "Literal['1']" cannot be assigned to parameter "a" of type "V@Base" in function "__init__" Β Β Type "Literal['1']" cannot be assigned to type "V@Base" (reportArgumentType) ``` Which clearly highlights that these are two distinct types (one being a `str` and the other being a [`TypeVar` (type variable)](https://docs.python.org/3/library/typing.html#typing.TypeVar)"). Moreover, using the syntax introduced in [PEP 695](https://peps.python.org/pep-0695/) may in fact clear up some confusion (refer to the PEP for details); reformatting your example code in that syntax may help make clear what the intent actually is: ```python @dataclass class Test[V: (str, int)]: a: V class Base[V: (str, int)]: def test(self) -> Test[V: (str, int)]: t = 1 return Test[V: (str, int)](t) # or alternatively def test2(self) -> Test[V]: t = 1 return Test[V](t) ``` It's a bit more clear that defining a return type `Test[V: (str, int)]` under this paradigm is not sensible, as the return type isn't one of the constrained types (so either `int` or `str`, and not whatever that `V: ...` tries to do). Not to mention that without the `class` prefixing `Test` pyright interpreted the subsequent `Test[V: (str, int)]` as a `slice` operation which is also nonsensical in that context. As for `test2`, the `V` is not bound to a concrete type at that context - the `V` in the `class` definition only serves as a placeholder for some concrete type that is defined to be either `int` or `str` which must be defined at the function return type context, so again, invalid. Based on the given code in the question, the `test` method really should have this signature: ```lang-python def test(self) -> Test[str]: t = '1' return Test[str](t) ``` The above would type check correctly. ----- I noted that the above doesn't actually answer the title of the question: "How to use a generic class type in combination with a function return type?" Since the above showed that a `TypeVar` is really a type variable, so we can use this where types are allowed. Consider the following: ```code-python class Base(Generic[V]): def test(self, t: V) -> Test[V]: return Test[V](t) b = Base[str]() b.test('1') c = Base[int]() c.test(1) ``` Now `b` and `c` are instances the `Base` class with one of the valid type restrictions, and if the argument `t` got substituted for the other type (e.g. swap `1` for `'1'` and vice versa, or even an invalid type), a type validation error will result.
--Remove Duplciates[SKR] --Option A: select * --delete t from( select rowNumber=row_number() over (partition by SomeKey order by SomeKey), SomeKey from YourTable m )t where rowNumber > 1; --Option B: with cte as ( select rowNumber=row_number() over (partition by SomeKey order by SomeKey), SomeKey from YourTable m ) --delete from cte where rowNumber > 1 select * from cte where rowNumber > 1
Time to come back and answer it. Django uses a different set of command line options, so you need something like ``` xml <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" /> </handlers> <httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\python.log" startupTimeLimit="20" processPath="C:\Users\<user name>\AppData\Local\Programs\Python\Python310\python.exe" arguments=".\mysite\manage.py runserver %HTTP_PLATFORM_PORT%"> </httpPlatform> </system.webServer> </configuration> ``` More details and the steps to try out can be found in my blog post. ## Reference https://docs.lextudio.com/blog/running-django-web-apps-on-iis-with-httpplatformhandler/
--Remove Duplciates[SKR] --Option A: select * --delete t from( select rowNumber=row_number() over (partition by SomeKey order by SomeKey), SomeKey from YourTable m )t where rowNumber > 1; --Option B: with cte as ( select rowNumber=row_number() over (partition by SomeKey order by SomeKey), SomeKey from YourTable m ) --delete from cte where rowNumber > 1 select * from cte where rowNumber > 1
My journey through creating a PDF form (upgrading old Zend PDF library to be able to do it) continues. I am struggling with checkbox and radio buttons, trying to get them displayed consistently. I did follow several guides and tips here and still there are differences in getting the button displayed in Chrome, Mozilla and Acrobat reader. It seems no matter what I do, Acrobat reader ignores defines content stream and replaces it with it's own for checked and unchecked state of the button. Strangely enough, it displays the defined stream when the checked button has focus. So when I set in the stream I want the checkbox to display let's say a cross (either through ZaDb character or just simply two crossed lines), Acrobat reader only displays the cross when I click and check the button. As soon as I click elsewhere, the cross is replaced with the default check mark. (Mozilla completely ignores any settings and just always displays their own icons so at least the user doesn't se two sets of icons.) So is there any way how I can force Acrobat reader to show the set stream content? Or is there a way to set the stream content exactly the same as the default acrobat reader? I have no problem using the default check mark but I can't get the position right with possibly dynamic size of the checkbox. Here is my source code with checkbox: ``` %PDF-1.5 %οΏ½οΏ½οΏ½οΏ½ 1 0 obj <</Type /Catalog /Version /1.5 /Pages 2 0 R /Acroform <</NeedAppearances false /Fields [7 0 R ] >> /Names 10 0 R >> endobj 2 0 obj <</Type /Pages /Kids [13 0 R ] /Count 1 >> endobj 3 0 obj <</Type /Font /Subtype /Type1 /Encoding /WinAnsiEncoding /BaseFont /Helvetica >> endobj 4 0 obj <</Type /Font /Subtype /Type1 /Encoding /WinAnsiEncoding /BaseFont /ZapfDingbats >> endobj 5 0 obj <</Length 58 /Type /XObject /Subtype /Form /BBox [0 0 15 15 ] /Resources <</ProcSet [/PDF /Text /ImageC /ImageB /ImageI ] /Font <</ZaDb 4 0 R >> >> /Matrix [1 0 0 1 0 0 ] >> stream /Tx BMCq BT 0 g /ZaDb 15 Tf 1 1 Td (5) Tj ET Q EMC endstream endobj 6 0 obj <</Length 17 /Type /XObject /Subtype /Form /BBox [0 0 15 15 ] /Resources <</ProcSet [/PDF /Text /ImageC /ImageB /ImageI ] /Font <</ZaDb 4 0 R >> >> /Matrix [1 0 0 1 0 0 ] >> stream Tx BMCq Q EMC endstream endobj 7 0 obj <</Type /Annot /Subtype /Widget /FT /Btn /Rect [200 350 215 365 ] /T (awesome) /DA (0 g /ZaDb 15 Tf) /F 4 /Ff 0 /V /Yes /AS /Yes /DR <</Font <</ZaDb 4 0 R >> >> /AP <</N <</Yes 5 0 R /Off 6 0 R >> >> /P 13 0 R >> endobj 8 0 obj [] endobj 9 0 obj <</Names 8 0 R >> endobj 10 0 obj <</Dests 12 0 R >> endobj 11 0 obj [] endobj 12 0 obj <</Names 11 0 R >> endobj 13 0 obj <</Type /Page /LastModified (D:20240331174748+02'00') /Resources <</ProcSet [/Text /PDF /ImageC /ImageB /ImageI ] /Font <</F1 15 0 R /ZaDb 4 0 R >> >> /MediaBox [0 0 595 842 ] /Contents [14 0 R ] /Annots [7 0 R ] /Parent 2 0 R >> endobj 14 0 obj <</Length 81 >> stream /F1 14 Tf 0 g 0 g BT 40 350 Td (Everything is awesome) Tj ET 200 350 15 15 re S endstream endobj 15 0 obj <</Type /Font /Encoding /WinAnsiEncoding /Subtype /Type1 /BaseFont /Helvetica >> endobj xref 0 16 0000000000 65535 f 0000000015 00000 n 0000000147 00000 n 0000000206 00000 n 0000000303 00000 n 0000000403 00000 n 0000000670 00000 n 0000000896 00000 n 0000001126 00000 n 0000001145 00000 n 0000001179 00000 n 0000001215 00000 n 0000001235 00000 n 0000001271 00000 n 0000001519 00000 n 0000001651 00000 n trailer <</ID [<61666330663231353135323634656134> <37623763336532323165643662643432> ] /Size 16 /Root 1 0 R >> startxref 1749 %%EOF ``` And here is the example PDF. https://filetransfer.io/data-package/eMwB3qGa#link Of course I have tried setting on and off the Needppeareance and followed several other guidelines about similar topics here.
You can remove by using the following command: ``` pnpm remove @types/mime ```
Try this and check out the documentation here: - https://vega.github.io/vega/docs/expressions/#pluck - https://vega.github.io/vega/docs/expressions/#extent - https://vega.github.io/vega/docs/expressions/#data ``` { "$schema": "https://vega.github.io/schema/vega-lite/v5.json", "data": { "values": [ {"date": "2021-03-01T00:00:00", "value": 1}, {"date": "2021-04-01T00:00:00", "value": 3}, {"date": "2021-05-01T00:00:00", "value": 2} ] }, "params": [ {"name": "extents", "expr": "extent(pluck(data('source_0'), 'value'))"}, {"name": "min", "expr": "extents[0]"}, {"name": "max", "expr": "extents[1]*2"} ], "mark": "line", "encoding": { "x": {"field": "date", "type": "temporal"}, "y": { "field": "value", "type": "quantitative", "scale": {"domain": {"expr": "[min,max]"}} } } } ```
before anything, you might see my language isn't really good in english, and i'm sorry about that. i want by clicking a button in WPF .net 8, to make a new instance of another window that i made to enter values and then use these values later, anyway, the problem here is that when i want to make an instance of that window in the C# background code of the main window "MainWindow.xaml", and when i execute the app, and press that button, the error occurs with this message: `System.IO.FileLoadException: 'The given assembly name was invalid.'`. and this message was on this code: ``` public Window_AddNew() { InitializeComponent(); // the error was on this line code } ``` and by the way, this code is from the C# background code that belongs to the other window that i want to show up and make an instance of it, and it's name is "Window_AddNew.xaml". for the buttons code that it should open the other window "Window_AddNew.xaml": ``` private void btn_new_Click(object sender, RoutedEventArgs e) { Window_AddNew window_AddNew = new Window_AddNew(); //Window window_AddNew = new Window_AddNew(); // i tried this also but there's no change window_AddNew.Show(); } ``` one more notice: i've noticed that the problem was happening while in the "MainWindow.xaml" C# code, this line was being executed `Window_AddNew window_AddNew = new Window_AddNew();`. i've tried `Window window_AddNew = new Window_AddNew();` instead of `Window_AddNew window_AddNew = new Window_AddNew();`, and i also tried this code `window_AddNew.ShowDialog();` instead of `window_AddNew.Show();`, but there is no change about the Problem. I hope someone can help me soon, and thank you all. for the code in the "MainWindow.xaml": ``` using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Data; using Microsoft.Data.SqlClient; using System.Configuration; namespace _3__Train_AdoNet_3 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void btn_new_Click(object sender, RoutedEventArgs e) { Window_AddNew window_AddNew = new Window_AddNew(); //Window window_AddNew = new Window_AddNew(); //window_AddNew.Show(); window_AddNew.ShowDialog(); } } } ``` and for the code in the "Window_AddNew.xaml": ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Data; using Microsoft.Data.SqlClient; using System.Configuration; namespace _3__Train_AdoNet_3 { /// <summary> /// Interaction logic for Window_AddNew.xaml /// </summary> public partial class Window_AddNew : Window { static string sqlConnString = ConfigurationManager.ConnectionStrings["sqlConnStr"].ConnectionString; SqlConnection sqlConn = new SqlConnection(sqlConnString); public Window_AddNew() { InitializeComponent(); } private void cmb_ProgrammingLanguages_ContextMenuOpening(object sender, ContextMenuEventArgs e) { DataTable dt_ProgrammingLanguages = new DataTable(); SqlDataAdapter sql_da_proglang = new SqlDataAdapter("sp_selectProgrammingLanguage", sqlConn); sql_da_proglang.Fill(dt_ProgrammingLanguages); cmb_ProgrammingLanguages.ItemsSource = dt_ProgrammingLanguages.DefaultView; } } } ```
Can't open new instance of another window of my app, in WPF .net 8
|c#|wpf|xaml|ado.net|instance|
null
You can set this property in your Style: <ListView.Resources> <Style TargetType="ListView"> <Setter Property="SeparatorVisibility" Value="None"/> </Style> </ListView.Resources>
When I deploy `Angular` project to `gcloud`, all the pages can be loaded normally, but when I refresh the page, I will get the error as the title, or if I access it directly by typing the URL, it will be wrong, and I can only access it from the homepage to not make the later pages wrong, this problem has been bothering me for a long time. My route is as follows: ``` const routes: Routes = [ { path: '', redirectTo: '/search/home', pathMatch: 'full'}, { path: 'search/home', component: SearchComponent }, { path: 'search/:ticker', component: SearchComponent }, { path: 'watchlist', component: WatchlistComponent }, { path: 'portfolio', component: PortfolioComponent }, ]; ``` My app.yaml file looks like this: ``` runtime: nodejs20 handlers: - url: / static_files: dist/stock-app/browser/index.html upload: dist/stock-app/browser/index.html - url: / static_dir: dist/stock-app/browser ```