text
string | meta
dict |
---|---|
Q: Need to know how to correct this order no in mysql I have view table(navicat) with some data.So i need to know how to correct this order on my Quary.
This is my Navicat View Quary.
SELECT
concat( `SAP_MATERIAL_MASTER_RM`.`OLD_ARTICLE_NUMBER`, '_', `SAP_BRAND`.`customer_sub_group` ) AS `OLD_ARTICLE_NUMBER`,
row_number() over ( ORDER BY `SAP_MATERIAL_MASTER_RM`.`id` ) AS `ARTICLE`,
'' AS `GENERIC_ARTICLE`,
`SAP_MATERIAL_MASTER_RM`.`IFS_BRAND` AS `IFS_BRAND`,
`SAP_MATERIAL_MASTER_RM`.`vendor` AS `vendor`,
`SAP_MATERIAL_MASTER_RM`.`CHARACTERISTICS` AS `CHARACTERISTICS_PROFILE`,
`SAP_MATERIAL_MASTER_RM`.`SAP_SIZE` AS `SIZE1_VALUE`
FROM
`SAP_MATERIAL_MASTER_RM`
LEFT JOIN `SAP_BRAND` ON `SAP_MATERIAL_MASTER_RM`.`IFS_BRAND` = `SAP_BRAND`.`p_family`
GROUP BY
`SAP_MATERIAL_MASTER_RM`.`OLD_ARTICLE_NUMBER`,
`SAP_MATERIAL_MASTER_RM`.`IFS_BRAND`,
`SAP_MATERIAL_MASTER_RM`.`vendor`,
`SAP_MATERIAL_MASTER_RM`.`CHARACTERISTICS`,
`SAP_MATERIAL_MASTER_RM`.`SAP_SIZE`
ORDER BY
`SAP_MATERIAL_MASTER_RM`.`id`
Need to support to correct GENERIC ARTICLE NO as below Example
enter image description here
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640454",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Can't play this video. video view in android Studio getting error
I am trying to play a video in Android studio using video View by giving the path it is stored in raw folder you can check it in the screenshot but on the emulator, it shows me can't play this video I even tried other answers to similar questions to this
this is activity_main.xml
<VideoView
android:id="@+id/testView"
android:layout_width="wrap_content"
android:layout_height="308dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.574"/>
this is MainActivity.kt
package com.example.video_player
import android.net.Uri
import android.net.Uri.*
import android.widget.MediaController
import android.widget.VideoView
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val videoView = findViewById<VideoView>(R.id.testView);
//Creating Media Controller
val mediaController = MediaController(this)
mediaController.setAnchorView(videoView)
//specify the location of media file
val uri:Uri = parse(
"android.resources://" + packageName
+ "/raw/test"
)
//Setting MediaController and URI, then starting the videoView
videoView.setMediaController(mediaController)
videoView.setVideoURI(uri)
videoView.requestFocus()
videoView.start()
}
}
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640455",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Android xml coding not auto match You are using the 2020.1.1 version.
When using Xml, if you type t, it should be automatically completed like android:text, but only tools appear. I don't know why.
enter image description here
Cache delet..
Reset program..
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640456",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: What does this angle-bracket notation in Typescript mean? I see this syntax in Typescript:
myFunc<MyType>(myObject)
What does it mean?
I understand that <MyType>myObject is a type-assertion.
But it makes no sense to me when <MyType> is between the function name and the open parenthesis.
A: It's called "Generics". You can read more about this in the official documentation: https://www.typescriptlang.org/docs/handbook/2/generics.html#handbook-content
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640458",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Change the Background color of a Gtk Toglebutton in Python I've been looking for a few days for information on how to change the colour of widgets in Python/Gtk 3 but haven't found much. What I specifically want to do is change the colour of ToggleButtons in CSS. The Gtk documentation is not help for me because I do not understand C.
I tried to understand the code at: Change the Background color of a Toglebutton when pressed in GTK3 (C language), and change it to Python, shown below, but the button colour does not change. Could someone kindly tell me if there is a good resource for Python programmers using CSS for Gtk programs or can someone point me in the correct direction to change the code below to work? Thank you in advance.
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
class btn:
def __init__(self):
# From https://stackoverflow.com/questions/41796529/
styleProvider=Gtk.CssProvider()
css = b"""
GtkWindow {
background-color: #A4A4A4;
color: cyan;
border-width: 3px;
border-color: blue;
}
#myGrid {
background-color: white;
border-style: solid;
border-width: 3px;
border-radius: 15px;
border-color: grey;
}
#myChild {
background-color: red;
border-style: solid;
border-width: 3px;
border-radius: 15px;
border-color: grey;
}
#tgl_btn{
background-color: red;
color: red;
}
GtkButton {
background-image: none;
background-color: blue;
}
GtkButton:active {
background-color: #00FF00;
}
"""
styleProvider.load_from_data(css)
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),styleProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
self.window = Gtk.Window()
self.btn = Gtk.ToggleButton(label = 'tgl_btn')
self.window.add(self.btn)
self.window.show_all()
def main(self):
Gtk.main()
p=btn()
p.main()
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640459",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Python Encoding/Decoding with Binary Strings Referencing:
*
*https://stackoverflow.com/questions/6224052/what-is-the-difference-between-a-string-and-a-byte-string#:~:text=In%20Python%2C%20a%20byte%20string,is%20a%20sequence%20of%20characters.
I am attempting to decode git objects:
import zlib
import os
...
# current directory is .git/objects
for current, subs, files in os.walk('.'):
for filename in files:
# in format ##/#{38}
path = os.path.join(current, filename)[2:]
# 'info/' and 'pack/' exist
# don't worry about packed files
with open(path, 'r') as file:
# returns bytes object
# assuming UTF-8 encoding (default) vs. legacy
# https://git-scm.com/docs/git-commit#_discussion
# .decode() also defaults to utf-8
print(zlib.decompress(file.read()).decode())
however, this runs into a UnicodeDecodeError and the correct method looks something like:
with open(path, 'rb') as file:
data = zlib.decompress(file.read())
header, content = data.split(b'\0', 1)
which then reads it as binary data. In another related post, a commenter mentioned that rb does not decode at all, which seems inaccurate, as the binary string presented is human-readable, and I would like clarification on this as the documentation is fairly sparse.
I have found that strings read with rb must be referenced by a prefixed b to be binary strings. My question is: why does decoding it not work if git by default (and in this repository) uses UTF-8? How does it decode and present the binary string as human-readable format (i.e, b'This is a string' if it is unable to decode it?
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640460",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Configuration Manager Configuration Baseline evaluation schedule in the deployment vs client settings How does the Configuration Manager Configuration Baseline evaluation schedule in the deployment settings work in conjunction with the evaluation schedule in the client settings? Does the evaluation schedule in the deployment take precedence over the evaluation schedule from the client settings?
For testing, I have set the "Specify the compliance evaluation schedule for this configuration baseline" in the deployment to 1 minute, but it is not running every minute. If I run the CB manually, it runs successfully.
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640462",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Can someone help me to find the errors here, Im really new at programming Image of the code
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
A: Variables are case sensitive. In your code, take a look at the srcode variable. srCode is not the same as SRCode or SrCode
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640464",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "-4"
}
|
Q: How come e.target.value not rendering when state is set on submit event? The calendar can be seen here https://vfvyoo.csb.app/ since I am not able to put some of the packages in the code snippet.
For some reason I can't get the price input value to render on the calendar after submitted. The title (price description) state is set and the e.target.value is updated on event but the price won't do the same and render.
Packages used: react-big-calendar, react-datepicker, date-fns
import { Calendar, dateFnsLocalizer } from "react-big-calendar";
import format from "date-fns/format";
import parse from "date-fns/parseISO";
import startOfWeek from "date-fns/parseISO";
import getDay from "date-fns/getDay";
import "./styles.css";
import "react-big-calendar/lib/css/react-big-calendar.css";
import "react-datepicker/dist/react-datepicker.css";
import React, { useState } from "react";
import DatePicker from "react-datepicker";
const locales = {
"en-US": require("date-fns/locale/en-US")
}
const localizer = dateFnsLocalizer({
format,
parse,
startOfWeek,
getDay,
locales
})
const data = [
{
title: "Normal Pricing",
price: "45",
start: new Date(2023, 3, 1),
end: new Date(2023, 3, 4)
},
{
title: "Summer Pricing",
price: "85",
start: new Date(2023, 3, 3),
end: new Date(2023, 3, 10)
},
{
title: "Winter Pricing",
price: "25",
start: new Date(2023, 3, 4),
end: new Date(2023, 3, 4)
}
];
function App() {
const [newPriceBlock, setNewPriceBlock] = useState({
title: "",
price: "",
start: "",
end: ""
});
const [allPriceBlocks, setAllPriceBlocks] = useState(data);
console.log(allPriceBlocks);
function handleAddPriceBlock() {
for (let i = 0; i < allPriceBlocks.length; i++) {
const d1 = new Date(allPriceBlocks[i].start);
const d2 = new Date(newPriceBlock.start);
const d3 = new Date(allPriceBlocks[i].end);
const d4 = new Date(newPriceBlock.end);
if ((d1 <= d2 && d2 <= d3) || (d1 <= d4 && d4 <= d3)) {
alert("CLASH");
break;
}
}
setAllPriceBlocks([...allPriceBlocks, newPriceBlock]);
}
return (
<div className="App">
<h2>Seasonal Pricing</h2>
<div className="price-block-entry">
<input
className="description-input"
type="text"
placeholder="Price Description"
value={newPriceBlock.title}
onChange={(e) =>
setNewPriceBlock({ ...newPriceBlock, title: e.target.value })
}
/>
<input
type="text"
placeholder="50.00"
value={newPriceBlock.price}
onChange={(e) =>
setNewPriceBlock({ ...newPriceBlock, price: e.target.value })
}
/>
<DatePicker
placeholderText="Start Date"
style={{ height: 500, margin: "50px" }}
selected={newPriceBlock.start}
onChange={(start) =>
setNewPriceBlock({ ...newPriceBlock, start: start })
}
/>
<DatePicker
placeholderText="End Date"
selected={newPriceBlock.end}
onChange={(end) => setNewPriceBlock({ ...newPriceBlock, end: end })}
/>
<button onClick={handleAddPriceBlock}>submit</button>
</div>
<Calendar
localizer={localizer}
events={allPriceBlocks}
startAccessor="start"
endAccessor="end"
style={{ height: 500, margin: "2%" }}
/>
</div>
);
}
export default App;
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640465",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Change plot axis with bioinfokit I have the following code which produces a volcano plot using Bioinfokit:
pip install bioinfokit
import pandas as pd
import numpy as np
import bioinfokit
from bioinfokit import analys, visuz
import random
lg2f = [random.uniform(-5,10) for i in range(0,4000)]
pad = [random.uniform(0.0000001,0.999) for i in range(0,4000)]
df1 = {'log2FoldChange':lg2f, 'padj':pad}
df1 = pd.DataFrame(df1)
bioinfokit.visuz.GeneExpression.volcano(df=df1, lfc='log2FoldChange', pv='padj', lfc_thr=(1.5,1.5), sign_line=True,plotlegend=True, legendpos='upper right', legendanchor=(1.46,1), dotsize=0.1, gfont=7,xlm=(-5.0,10.0,1), pv_thr=(0.05,0.05))
The following plot is produced:
However, I am trying to find a way to extend the X-axis so that it ranges from -10 to 10. Currently the x-axis extends from -5 to 9.
Please let me know if you have ideas. I tried adding a "fake" data point in which to extend the axis but this does not really work very well.
Thanks
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640466",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: How to select every row to satisfy any rule described in a different table? I have a table numbers:
id
n
1
1
2
2
3
5
4
7
5
9
And I have a table of rules:
rule_type
n
LT
2
GT
7
GT
9
EQ
2
(LT - less-than, GT - greater-than, EQ - equals).
I want to select every id from numbers, that satisfies any rule from table rules.
Expected result:
id
1
2
5
P.S. I use PostgreSQL 15.1.
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640467",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: How to remove the search icon background while clicking(like focus)? enter image description here
while clicking search icon it shows gray background color, how can i fix the background to transparent using Bootstrap 4.6
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640472",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Return top level keys from map with a generalised type argument I have the following method which returns all the keys from the map. But the argument it accepts must be of type map[string]string.
func GetAllKeys(m map[string]string) []string {
keys := make([]string, len(m))
i := 0
for k := range m {
keys[i] = k
i++
}
return keys
}
How could I reuse this method, if I have a map but with a type map[string]map[string]string. Is there a way to generalize this method, because all it has to do is return the top-level keys from the map.
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640476",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: How to better visualize python file structure with VS 2022 In PyCharm, I can check the structure of my current file using the "Structure" window. The figure below shows this window circled in red.
In Visual Studio 2022, all I could find was the drop down as circled in the figure below.
I find this to be quite underwhelming. Is it possible to get a slightly more informative file structure in Visual Studio 2022 for the Python files I'm working on? If so how?
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640477",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Python NLP error can anyone explain more to me of why this error is occuring due to inputs i assume but where am i wrong This is my code I am able to execute all lines till the model. fit(X_train, y_train, epochs = 5, validation_data = (X_test, y_test)). I am just wondering if someone knows why and explain to me in detail I assume that my input variables in the line is the problem that I am having but I dint understand why
from tensorflow.keras.preprocessing.text import one_hot,Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense,Flatten,Embedding,Activation,Dropout
from tensorflow.keras.layers import Conv1D, MaxPooling1D, GlobalMaxPooling1D
import numpy as np
from numpy import array
import pandas as pd
from sklearn.model_selection import train_test_split
df = pd.read_csv('IMDB Dataset.csv')
df.head()
df['sentiment'].value_counts()
text = df['review'].tolist()
text
y = df['sentiment']
token = Tokenizer()
token.fit_on_texts(text)
token
token.word_index
vocab_size = len(token.word_index) + 1
vocab_size
encoded_text = token.texts_to_sequences(text)
encoded_text
max_length = 120
X = pad_sequences(encoded_text, maxlen = max_length , padding ='post')
X.shape
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state = 42,test_size = 0.2,stratify = y)
vec_size = 300
model = Sequential()
model.add(Embedding(vocab_size, vec_size, input_length = max_length))
model.add(Conv1D(64, 8, activation = 'relu'))
model.add(MaxPooling1D(2))
model.add(Dropout(0.2))
model.add(Dense(32, activation = 'relu'))
model.add(Dropout(0.5))
model.add(Dense(16, activation = 'relu'))
model.add(GlobalMaxPooling1D())
model.add(Dense(1, activation = 'sigmoid'))
model.compile(optimizer='adam',loss = 'binary_crossentropy', metrics = ['accuracy'])
%%time
model.fit(X_train, y_train, epochs = 5, validation_data = (X_test, y_test))
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640478",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: How to set a conditional on shopify (.liquid) so I can set a minimun weight (kg) order This is my code, I want to add a conditional of weight, so I can set a minimun weight (Kg) order, Ej. If a client order 5kg of product, the buy buttom wont appears, and if the client order more than 10kg the button appears. here are all the code information,
<div class="totals">
<h2 class="totals__subtotal">{{ 'sections.cart.subtotal' | t }}</h2>
<p class="totals__subtotal-value">{{ cart.total_price | money_with_currency }}</p>
</div>
<div>
{%- if cart.cart_level_discount_applications.size > 0 -%}
<ul class="discounts list-unstyled" role="list" aria-label="{{ 'customer.order.discount' | t }}">
{%- for discount in cart.cart_level_discount_applications -%}
<li class="discounts__discount discounts__discount--position">
{%- render 'icon-discount' -%}
{{ discount.title }}
(-{{ discount.total_allocated_amount | money }})
</li>
{%- endfor -%}
</ul>
{%- endif -%}
</div>
<small class="tax-note caption-large rte">
{%- if cart.taxes_included and shop.shipping_policy.body != blank -%}
{{ 'sections.cart.taxes_included_and_shipping_policy_html' | t: link: shop.shipping_policy.url }}
{%- elsif cart.taxes_included -%}
{{ 'sections.cart.taxes_included_but_shipping_at_checkout' | t }}
{%- elsif shop.shipping_policy.body != blank -%}
{{ 'sections.cart.taxes_and_shipping_policy_at_checkout_html' | t: link: shop.shipping_policy.url }}
{%- else -%}
{{ 'sections.cart.taxes_and_shipping_at_checkout' | t }}
{%- endif -%}
</small>
</div>
<div class="cart__ctas" {{ block.shopify_attributes }}>
<noscript>
<button type="submit" class="cart__update-button button button--secondary" form="cart">
{{ 'sections.cart.update' | t }}
</button>
</noscript>
<button
type="submit"
id="checkout"
class="cart__checkout-button button"
name="checkout"
{% if cart == empty%}
disabled
{% endif %}
form="cart"
>
{{ 'sections.cart.checkout' | t }}
</button>
</div>
{%- if additional_checkout_buttons -%}
<div class="cart__dynamic-checkout-buttons additional-checkout-buttons">
{{ content_for_additional_checkout_buttons }}
</div>
{%- endif -%}
{%- endcase -%}
{% endfor %}
alsdjkflakdsjf asdkjflasdkjflaksdjflkajsd alsdkfjladksjflasdkfjla asldjfalksdjflakdsjflak alskdflakdsjflakdjfla lakdflakdjflakdjfla ladksfjlakdjfñalsdkjfpoaidqowd oaiwej rpqowei rqodncoqdncqwdcoqwijedflasdkncla
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640480",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: Why does "Undefined Reference to" error occur while included header holds the referenced function? I am writing a simple C program that changes the value of a data structure to 100.
#include"node.h"
#include <stdio.h>
int main() {
simpleObject object1;
object1.x = 200;
updateLocation(&object1);
printf("%d", object1.x);
}
It holds 2 other files, the header file named "node" and the source file also named "node".
"node.h"
typedef struct {
float x;
float y;
float z;
float mass;
} simpleObject;
void updateLocation(simpleObject* initObject);
"node.c"
#include "node.h"
void updateLocation(simpleObject* initObject) {
initObject -> x = 100;
}
When the file was compiled, I was given this error:
undefined reference to `updateLocation(simpleObject*)' collect2.exe: error: ld returned 1 exit status
I am completely confused as to why the updateLocation function is not defined, even though it is defined within "node.c".
When the code from "node.c" was deleted and placed in "node.h" in place of the declaration, it worked, but printed out 0.
What is occuring within my code?
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640481",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|
Q: How to create views in Mongoose or how to get using native driver access Looks like mongoose does not support views - as far as I have searched. So, I tried using native MongoDB commands like this:
const mongoose = require('mongoose')
...
mongoose.connection.db.createView("<view name>", "<source collection>", [
{
$lookup: { ... }
},
{
$project: { ... }
},
{ $unwind: ... }
])
But I get this error:
mongoose.connection.db.createView("<view name>", "<source coll.>", [
TypeError: Cannot read properties of undefined (reading 'createView')
Using mongoose version 6.8.1. What am I missing? I need to join two collections and create a view.
|
{
"language": "en",
"url": "https://stackoverflow.com/questions/75640482",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
}
|